Hi all, I found only unanswered questions to my own question about how to override theme function of an another module and not using phptemplate eg. http://lists.drupal.org/archives/themes/2007-07/msg00000.html http://lists.drupal.org/archives/development/2007-04/msg00318.html As my problem is basically similar, I would like to ask for confirmation that it is not possible to easily override themeing of a module. In my own module (ejournal) user can set up many publications and these publications should share the same code for the functionality, yet not necessarily the same code for design. So far, the themeing functions of the module can be overriden becase they are enclosed in calls if(!function_exists('theme_ejournal_issue')) { function theme_ejournal_issue().... } it is possible to override these themeing functions on a journal basis, using chosen .inc files to be loaded, but lately i was thinking if there is not an easier and more elegant way how to conditionally override the module's themeing functions Thanks for any answer, hint, confirmation etc. roman
Hi, Maybe this will help Normally if one has a module, lets call it mymodule then one would provide theming functions along the lines of function theme_module_page(...) { } function theme_module_paragraph(...) { } Then when calling these functions one would use theme('module_page', ...); and theme('module_paragraph', ...); The theme function is the key here, it not only provides the override mechanism but also only makes a function call if it finds an valid theme function. So there is no need for the caller to do any checking. Then in using phptemplates one can override with either function phptemplate_module_page(...) { } or function themename_module_page(...) { } (I think there are similiar ways using the other template engines) Nevets
participants (2)
-
Roman Chyla -
Steve Ringwood