views:

72

answers:

3

I'm using Ubercart and I'm attempting to override the following theme function theme_address_pane() which is in uc_cart_checkout_pane.inc. So I wrote the following function in template.php:

function mytheme_address_pane($form) {
    return "asdf";
}

However, it isn't replacing anything with "asdf". What could I be doing wrong?

Edit: The devel module reports the function being called as theme_address_pane, not my overridden one.

+2  A: 

Whenever dealing with the theming system, you often have to clear the cache to see it come to effect. Not the entire cache, just the theme registry. Here drupal stores info about which theming function and template to use. So whenever you want to change which function or template to use, you have to clear the cache.

When changing a function or template directly, clearing the cache wont be needed. Drupal wont cache the function or template, itself, but only the location/name. So you can happily alter in your theme function once you have made sure drupal has registered it.

googletorp
+1  A: 

If you put the following at the top of your template.php file (inside the php tag):

drupal_flush_all_caches();

It will clear the cache everytime the page loads. This way you won't have to flush the caches manually. However, be SURE to REMOVE it before the theme gets published, or you will see a HUGE performance hit on every page load!

Brent Hardinge
A: 

To alter a theme function in Drupal 6 you need to implement hook_theme_registry_alter().

kiamlaluno