Drupal: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:


* Normally each module should register some theme hooks, which basically means that their output can be changed by themes (a default output should be provided as well). This can be done via a function (default) or the use of a template file. Some common registration are found in the common.inc file, for example a registration for the theme_links function.
* Normally each module should register some theme hooks, which basically means that their output can be changed by themes (a default output should be provided as well). This can be done via a function (default) or the use of a template file. Some common registration are found in the common.inc file, for example a registration for the theme_links function.
* When looking for the default function for a theme function override, use the name of the function preceded by theme. For instance theme_menu_tree; never touch menu_tree directly.

Revision as of 16:30, 6 December 2010

Themes

  • You can have a separate theme for the front end and the back office, but by default the theme is used for both aspects. Go to Administer -> Site configuration -> Administration theme to configure this.
  • When developping a theme, add the following function to your theme template.php file to flush the theme registry (apparently needed):
drupal_rebuild_theme_registry();

Adding regions to Themes

  • This is done in the theme's .info file. After that you can assign blocks to these regions; the region should be outputted in the theme's page.tpl.php file (via print $regionname).
  • Note that when JavaScript is active, the Weight field is not displayed in the Blocks administration page (you can drag & drop via JS to change the weight). It is displayed when JS is not enabled or the scripts are not loaded, so don't be surprised.

Customizing modules

  • Normally each module should register some theme hooks, which basically means that their output can be changed by themes (a default output should be provided as well). This can be done via a function (default) or the use of a template file. Some common registration are found in the common.inc file, for example a registration for the theme_links function.
  • When looking for the default function for a theme function override, use the name of the function preceded by theme. For instance theme_menu_tree; never touch menu_tree directly.