By phdhiren on
Hi,
I'm converting one module from 5.x to 6.x
There is functionality to choose and create theming dynamically.
version 5.x looks something like this:
$function = "theme_modulename_layout_$layout";
if (function_exists($function)) {
return theme("modulename_layout_$layout", $params);
}
The problem is that with Drupal 6.x we've to register each function as theme_modulename_function_name in the function theme_modulename
But the function name comes dynamically depending on function existence.
How do I do that?
Thanks in advance.
-Hiren
Comments
...
There's a problem here in the first place. If I name my theme function 'garland_something', your code won't detect it. You should use theme_get_function() instead of function_exists().
To see how this is done in D6, have a look at 'drupal_render_form()', which is in 'form.inc'.
ya, but..1. Drupal 6 no
ya, but...
1. Drupal 6 no longer supports theme_get_function()
http://api.drupal.org/api/function/theme_get_function/5
2. Apart from that if my theme function name is 'garland_something', it would be called because it will override the 'theme_something', and 'theme_something' has to be exists.
Still the original question is still pending, I would like to register the theme function name dynamically with Drupal 6 theme registery.