Default theme implementations

Functions and templates that present output to the user, and can be implemented by themes.

Drupal's presentation layer is a pluggable system known as the theme layer. Each theme can take control over most of Drupal's output, and has complete control over the CSS.

Inside Drupal, the theme layer is utilized by the use of the theme() function, which is passed the name of a component (the theme hook) and an array of variables. For example, theme('table', array('header' => $header, 'rows' => $rows)); Additionally, the theme() function can take an array of theme hooks, which can be used to provide 'fallback' implementations to allow for more specific control of output. For example, the function: theme(array('table__foo', 'table'), $variables) would look to see if 'table__foo' is registered anywhere; if it is not, it would 'fall back' to the generic 'table' implementation. This can be used to attach specific theme functions to named objects, allowing the themer more control over specific types of output.

As of Drupal 6, every theme hook is required to be registered by the module that owns it, so that Drupal can tell what to do with it and to make it simple for themes to identify and override the behavior for these calls.

The theme hooks are registered via hook_theme(), which returns an array of arrays with information about the hook. It describes the arguments the function or template will need, and provides defaults for the template in case they are not filled in. If the default implementation is a function, by convention it is named theme_HOOK().

Each module should provide a default implementation for theme_hooks that it registers. This implementation may be either a function or a template; if it is a function it must be specified via hook_theme(). By convention, default implementations of theme hooks are named theme_HOOK. Default template implementations are stored in the module directory.

Drupal's default template renderer is a simple PHP parsing engine that includes the template and stores the output. Drupal's theme engines can provide alternate template engines, such as XTemplate, Smarty and PHPTal. The most common template engine is PHPTemplate (included with Drupal and implemented in phptemplate.engine, which uses Drupal's default template renderer.

In order to create theme-specific implementations of these hooks, themes can implement their own version of theme hooks, either as functions or templates. These implementations will be used instead of the default implementation. If using a pure .theme without an engine, the .theme is required to implement its own version of hook_theme() to tell Drupal what it is implementing; themes utilizing an engine will have their well-named theming functions automatically registered for them. While this can vary based upon the theme engine, the standard set by phptemplate is that theme functions should be named THEMENAME_HOOK. For example, for Drupal's default theme (Garland) to implement the 'table' hook, the phptemplate.engine would find garland_table().

The theme system is described and defined in theme.inc.

See also

theme()

@see hook_theme()

End of "defgroup themeable".

Functions

NameLocationDescription
template_preprocess_menu_treeincludes/menu.incPreprocess the rendered tree for theme_menu_tree.
template_preprocess_usernameincludes/theme.incPreprocess variables for theme_username().
template_process_usernameincludes/theme.incProcess variables for theme_username().
theme_admin_blockmodules/system/system.admin.incThis function formats an administrative block for display.
theme_admin_block_contentmodules/system/system.admin.incThis function formats the content of an administrative block.
theme_admin_pagemodules/system/system.admin.incThis function formats an administrative page for viewing.
theme_aggregator_page_opmlmodules/aggregator/aggregator.pages.incTheme the OPML feed output.
theme_aggregator_page_rssmodules/aggregator/aggregator.pages.incTheme the RSS output.
theme_book_admin_tablemodules/book/book.admin.incTheme function for the book administration page form.
theme_book_title_linkmodules/book/book.moduleGenerate the HTML output for a link to a book title when used as a block title.
theme_breadcrumbincludes/theme.incReturn a themed breadcrumb trail.
theme_buttonincludes/form.incTheme a button form element.
theme_checkboxincludes/form.incTheme a checkbox form element.
theme_checkboxesincludes/form.incTheme a set of checkbox form elements.
theme_color_scheme_formmodules/color/color.moduleTheme the color form.
theme_comment_post_forbiddenmodules/comment/comment.moduleTheme a "you can't post comments" notice.
theme_confirm_formmodules/system/system.moduleTheme confirmation forms.
theme_containerincludes/form.incAdds a container for grouped items.
theme_dashboardmodules/dashboard/dashboard.moduleTheme the entire dashboard.
theme_dashboard_adminmodules/dashboard/dashboard.moduleTheme the page containing the dashboard.
theme_dashboard_disabled_blockmodules/dashboard/dashboard.moduleTheme a disabled block, for display in dashboard customization mode.
theme_dashboard_disabled_blocksmodules/dashboard/dashboard.moduleTheme a set of disabled blocks, for display in dashboard customization mode.
theme_dashboard_regionmodules/dashboard/dashboard.moduleTheme a generic dashboard region.
theme_dateincludes/form.incTheme a date selection form element.
theme_feed_iconincludes/theme.incReturn code that emits an feed icon.
theme_fieldmodules/field/field.moduleReturns a themed field.
theme_fieldsetincludes/form.incTheme a fieldset form element.
theme_fileincludes/form.incTheme a file upload form element.
theme_filter_admin_format_filter_ordermodules/filter/filter.admin.incTheme text format filter order form elements as tabledrag.
theme_filter_admin_overviewmodules/filter/filter.admin.incTheme the text format administration overview form.
theme_filter_guidelinesmodules/filter/filter.moduleFormat guidelines for a text format.
theme_filter_tipsmodules/filter/filter.pages.incRender HTML for a set of filter tips.
theme_filter_tips_more_infomodules/filter/filter.moduleFormat a link to the more extensive filter tips.
theme_formincludes/form.incTheme a form.
theme_form_elementincludes/form.incTheme a form element.
theme_form_element_labelincludes/form.incTheme a form element label and required marker.
theme_form_required_markerincludes/form.incTheme the marker for required form elements.
theme_forum_formmodules/forum/forum.admin.incTheme forum forms.
theme_hiddenincludes/form.incTheme a hidden form element.
theme_html_tagincludes/theme.incGenerate the output for a generic HTML tag with attributes.
theme_imageincludes/theme.incReturn a themed image.
theme_image_anchormodules/image/image.admin.incTheme callback for displaying a grid of checkboxes.
theme_image_crop_summarymodules/image/image.admin.incTheme callback for image crop effect summary output.
theme_image_resize_summarymodules/image/image.admin.incTheme callback for image resize effect summary output.
theme_image_rotate_summarymodules/image/image.admin.incTheme callback for image rotate effect summary output.
theme_image_scale_summarymodules/image/image.admin.incTheme callback for image scale effect summary output.
theme_image_style_effectsmodules/image/image.admin.incTheme callback for listing the effects within a specific image style.
theme_image_style_listmodules/image/image.admin.incDisplay the page containing the list of image styles.
theme_image_style_previewmodules/image/image.admin.incTheme callback for displaying a preview of an image style.
theme_indentationincludes/theme.incCreate a standard indentation div. Used for drag and drop tables.
theme_item_listincludes/theme.incReturn a themed list of items.
theme_linkincludes/theme.incReturn a themed link.
theme_linksincludes/theme.incReturn a themed set of links.
theme_locale_date_format_formmodules/locale/locale.admin.incTheme locale date format form.
theme_locale_languages_configure_formmodules/locale/locale.admin.incTheme the language configure form.
theme_locale_languages_overview_formmodules/locale/locale.admin.incTheme the language overview form.
theme_markincludes/theme.incReturn a themed marker, useful for marking new or updated content.
theme_menu_linkincludes/menu.incGenerate the HTML output for a menu link and submenu.
theme_menu_local_actionincludes/menu.incGenerate the HTML output for a single local action link.
theme_menu_local_taskincludes/menu.incGenerate the HTML output for a single local task link.
theme_menu_local_tasksincludes/menu.incReturns renderable local tasks.
theme_menu_overview_formmodules/menu/menu.admin.incTheme the menu overview form into a table.
theme_menu_treeincludes/menu.incTheme wrapper for the HTML output for a menu sub-tree.
theme_more_help_linkincludes/theme.incReturns code that emits the 'more help'-link.
theme_more_linkincludes/theme.incReturns code that emits the 'more' link used on blocks.
theme_node_add_listmodules/node/node.pages.incDisplay the list of available node types for node creation.
theme_node_filtersmodules/node/node.admin.incTheme node administration filter selector.
theme_node_listmodules/node/node.moduleFormat a listing of links to nodes.
theme_node_log_messagemodules/node/node.moduleTheme a log message.
theme_node_previewmodules/node/node.pages.incDisplay a node preview for display during node creation and editing.
theme_node_search_adminmodules/node/node.moduleTheme the content ranking part of the search settings admin page.
theme_pagerincludes/pager.incFormat a query pager.
theme_pager_firstincludes/pager.incFormat a "first page" link.
theme_pager_lastincludes/pager.incFormat a "last page" link.
theme_pager_linkincludes/pager.incFormat a link to a specific query result page.
theme_pager_nextincludes/pager.incFormat a "next page" link.
theme_pager_previousincludes/pager.incFormat a "previous page" link.
theme_passwordincludes/form.incTheme a password form element.
theme_poll_choicesmodules/poll/poll.moduleTheme the admin poll form for choices.
theme_profile_admin_overviewmodules/profile/profile.admin.incTheme the profile field overview into a drag and drop enabled table.
theme_progress_barincludes/theme.incReturn a themed progress bar.
theme_radioincludes/form.incTheme a radio button form element.
theme_radiosincludes/form.incTheme a set of radio button form elements.
theme_rdf_metadatamodules/rdf/rdf.moduleOutputs a series of empty spans for exporting RDF metadata in RDFa.
theme_rdf_template_variable_wrappermodules/rdf/rdf.moduleWraps a template variable in an HTML element with the desired attributes.
theme_selectincludes/form.incTheme select form element.
theme_shortcut_set_customizemodules/shortcut/shortcut.admin.incThemes the shortcut set customization form.
theme_status_messagesincludes/theme.incReturn a themed set of status and/or error messages. The messages are grouped by type.
theme_status_reportmodules/system/system.admin.incTheme requirements status report.
theme_submitincludes/form.incTheme a submit button form element.
theme_syslog_formatmodules/syslog/syslog.moduleFormat a system log entry.
theme_system_admin_by_modulemodules/system/system.admin.incTheme output of the dashboard page.
theme_system_compact_linkmodules/system/system.moduleDisplay the link to show or hide inline help descriptions.
theme_system_date_time_settingsmodules/system/system.admin.incTheme function for date settings form.
theme_system_modules_fieldsetmodules/system/system.admin.incTheme callback for the modules form.
theme_system_modules_incompatiblemodules/system/system.admin.incThemes an incompatible message.
theme_system_modules_uninstallmodules/system/system.admin.incThemes a table of currently disabled modules.
theme_system_powered_bymodules/system/system.moduleFormat the Powered by Drupal text.
theme_system_settings_formmodules/system/system.moduleTheme function for the system settings form.
theme_system_themes_pagemodules/system/system.admin.incTheme function for the system themes form.
theme_tableincludes/theme.incReturn a themed table.
theme_tableselectincludes/form.incFormats a table with radio buttons or checkboxes.
theme_tablesort_indicatorincludes/theme.incReturn a themed sort icon.
theme_table_select_header_cellincludes/theme.incReturns a header cell for tables that have a select all functionality.
theme_task_listincludes/theme.maintenance.incReturn a themed list of maintenance tasks to perform.
theme_taxonomy_overview_termsmodules/taxonomy/taxonomy.admin.incTheme the terms overview as a sortable list of terms.
theme_taxonomy_overview_vocabulariesmodules/taxonomy/taxonomy.admin.incTheme the vocabulary overview as a sortable list of vocabularies.
theme_textareaincludes/form.incTheme a textarea form element.
theme_textfieldincludes/form.incTheme a textfield form element.
theme_text_format_wrappermodules/filter/filter.moduleRender a text format-enabled form element.
theme_trigger_displaymodules/trigger/trigger.admin.incDisplays actions assigned to this hook in a table.
theme_update_last_checkmodules/update/update.moduleRender the HTML to display the last time we checked for update data.
theme_update_manager_update_formmodules/update/update.manager.incTheme the first page in the update manager wizard to select projects.
theme_update_reportmodules/update/update.report.incTheme project status report.
theme_update_versionmodules/update/update.report.incTheme the version display of a project.
theme_usernameincludes/theme.incFormat a username.
theme_user_admin_new_rolemodules/user/user.admin.incTheme the new-role form.
theme_user_admin_permissionsmodules/user/user.admin.incTheme the administer permissions page.
theme_user_filtersmodules/user/user.admin.incTheme user administration filter selector.
theme_user_listmodules/user/user.moduleMake a list of users.
theme_user_signaturemodules/user/user.moduleTheme output of user signature.
theme_vertical_tabsincludes/form.incMakes the element's children fieldsets be vertical tabs.