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 several arguments. For example, theme('table', $header, $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'), $header, $rows) 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 either phptemplate_HOOK or THEMENAME_HOOK. For example, for Drupal's default theme (Garland) to implement the 'table' hook, the phptemplate.engine would find phptemplate_table() or garland_table(). The ENGINE_HOOK() syntax is preferred, as this can be used by sub-themes (which are themes that share code but use different stylesheets).

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

See also

theme()

@see hook_theme()

Functions

NameLocationDescription
ctools_garland_menu_local_taskscontrib-6/ctools/includes/menu.incReturns the rendered local tasks. The default implementation renders them as tabs. Overridden to split the secondary tasks.
phptemplate_menu_local_tasksdrupal-6/themes/garland/template.phpReturns the rendered local tasks. The default implementation renders them as tabs. Overridden to split the secondary tasks.
theme_admin_blockdrupal-6/modules/system/system.admin.incThis function formats an administrative block for display.
theme_admin_block_contentdrupal-6/modules/system/system.admin.incThis function formats the content of an administrative block.
theme_admin_menu_iconcontrib-6/admin_menu/admin_menu.incRender an icon to display in the administration menu.
theme_admin_pagedrupal-6/modules/system/system.admin.incThis function formats an administrative page for viewing.
theme_aggregator_feed_sourcedocs-6/theme.phpImplemented using the aggregator-feed-source.tpl.php template.
theme_aggregator_itemdocs-6/theme.phpImplemented using the aggregator-item.tpl.php template.
theme_aggregator_page_opmldrupal-6/modules/aggregator/aggregator.pages.incTheme the OPML feed output.
theme_aggregator_page_rssdrupal-6/modules/aggregator/aggregator.pages.incTheme the RSS output.
theme_aggregator_summary_itemdocs-6/theme.phpImplemented using the aggregator-summary-item.tpl.php template.
theme_aggregator_summary_itemsdocs-6/theme.phpImplemented using the aggregator-summary-items.tpl.php template.
theme_aggregator_wrapperdocs-6/theme.phpImplemented using the aggregator-wrapper.tpl.php template.
theme_blockdocs-6/theme.phpImplemented using the block.tpl.php template.
theme_blocksdrupal-6/includes/theme.incReturn a set of blocks available for the current user.
theme_block_admin_display_formdocs-6/theme.phpImplemented using the block-admin-display-form.tpl.php template.
theme_book_admin_tabledrupal-6/modules/book/book.admin.incTheme function for the book administration page form.
theme_book_all_books_blockdocs-6/theme.phpImplemented using the book-all-books-block.tpl.php template.
theme_book_export_htmldocs-6/theme.phpImplemented using the book-export-html.tpl.php template.
theme_book_navigationdocs-6/theme.phpImplemented using the book-navigation.tpl.php template.
theme_book_node_export_htmldocs-6/theme.phpImplemented using the book-node-export-html.tpl.php template.
theme_book_title_linkdrupal-6/modules/book/book.moduleGenerate the HTML output for a link to a book title when used as a block title.
theme_breadcrumbdrupal-6/includes/theme.incReturn a themed breadcrumb trail.
theme_buttondrupal-6/includes/form.incTheme a form button.
theme_checkboxdrupal-6/includes/form.incFormat a checkbox.
theme_checkboxesdrupal-6/includes/form.incFormat a set of checkboxes.
theme_closuredrupal-6/includes/theme.incExecute hook_footer() which is run at the end of the page right before the close of the body tag.
theme_color_scheme_formdrupal-6/modules/color/color.moduleTheme color form.
theme_commentdocs-6/theme.phpImplemented using the comment.tpl.php template.
theme_comment_admin_overviewdrupal-6/modules/comment/comment.admin.incTheme the comment admin form.
theme_comment_controlsdrupal-6/modules/comment/comment.moduleTheme comment controls box where the user can change the default display mode and display order of comments.
theme_comment_flat_collapseddrupal-6/modules/comment/comment.moduleTheme comment flat collapsed view.
theme_comment_flat_expandeddrupal-6/modules/comment/comment.moduleTheme comment flat expanded view.
theme_comment_foldeddocs-6/theme.phpImplemented using the comment-folded.tpl.php template.
theme_comment_post_forbiddendrupal-6/modules/comment/comment.moduleTheme a "you can't post comments" notice.
theme_comment_submitteddrupal-6/modules/comment/comment.moduleTheme a "Submitted by ..." notice.
theme_comment_thread_collapseddrupal-6/modules/comment/comment.moduleTheme comment thread collapsed view.
theme_comment_thread_expandeddrupal-6/modules/comment/comment.moduleTheme comment thread expanded view.
theme_comment_viewdrupal-6/modules/comment/comment.moduleThemes a single comment and related items.
theme_comment_wrapperdocs-6/theme.phpImplemented using the comment-wrapper.tpl.php template.
theme_datedrupal-6/includes/form.incFormat a date selection element.
theme_date_all_daycontrib-6/date/date/date.themeAdjust from/to date format to account for 'all day'.
theme_date_all_day_labelcontrib-6/date/date/date.themeTheme the way an 'all day' label will look.
theme_date_display_combinationcontrib-6/date/date/date.themeTheme from/to date combination in the view.
theme_date_format_intervalcontrib-6/date/date/date.themeTheme a format interval for a date element
theme_date_repeat_displaycontrib-6/date/date/date.themeTheme the human-readable description for a Date Repeat rule.
theme_dblog_filtersdrupal-6/modules/dblog/dblog.moduleTheme dblog administration filter selector.
theme_ec_checkout_admin_screen_formcontrib-6/ecommerce/ec_checkout/ec_checkout.theme.incThemes the admin screen.
theme_ec_mail_checkout_formcontrib-6/ecommerce/ec_customer/ec_customer.theme.incInsert the email field in case the user is not logged
theme_ec_product_autocompletecontrib-6/ecommerce/ec_product/ec_product.theme.inc
theme_ec_product_edit_formcontrib-6/ecommerce/ec_product/ec_product.theme.inc
theme_ec_product_edit_form_productcontrib-6/ecommerce/ec_product/ec_product.theme.inc
theme_ec_receipt_admin_rtypes_formcontrib-6/ecommerce/ec_receipt/ec_receipt.theme.inc
theme_ec_receipt_iconcontrib-6/ecommerce/ec_receipt/ec_receipt.theme.inc
theme_feed_icondrupal-6/includes/theme.incReturn code that emits an feed icon.
theme_fieldsetdrupal-6/includes/form.incFormat a group of form items.
theme_filedrupal-6/includes/form.incFormat a file upload field.
theme_filter_admin_orderdrupal-6/modules/filter/filter.admin.incTheme filter order configuration form.
theme_filter_admin_overviewdrupal-6/modules/filter/filter.admin.incTheme the admin overview form.
theme_filter_tipsdrupal-6/modules/filter/filter.pages.incFormat a set of filter tips.
theme_filter_tips_more_infodrupal-6/modules/filter/filter.moduleFormat a link to the more extensive filter tips.
theme_formdrupal-6/includes/form.incFormat a form.
theme_form_elementdrupal-6/includes/form.incReturn a themed form element.
theme_forumsdocs-6/theme.phpImplemented using the forums.tpl.php template.
theme_forum_icondocs-6/theme.phpImplemented using the forum-icon.tpl.php template.
theme_forum_listdocs-6/theme.phpImplemented using the forum-list.tpl.php template.
theme_forum_submitteddocs-6/theme.phpImplemented using the forum-submitted.tpl.php template.
theme_forum_topic_listdocs-6/theme.phpImplemented using the forum-topic-list.tpl.php template.
theme_forum_topic_navigationdocs-6/theme.phpImplemented using the forum-topic-navigation.tpl.php template.
theme_helpdrupal-6/includes/theme.incReturn a themed help message.
theme_hiddendrupal-6/includes/form.incFormat a hidden form field.
theme_imagedrupal-6/includes/theme.incReturn a themed image.
theme_image_buttondrupal-6/includes/form.incTheme a form image button.
theme_indentationdrupal-6/includes/theme.incCreate a standard indentation div. Used for drag and drop tables.
theme_itemdrupal-6/includes/form.incFormat a form item.
theme_item_listdrupal-6/includes/theme.incReturn a themed list of items.
theme_linksdrupal-6/includes/theme.incReturn a themed set of links.
theme_locale_languages_overview_formdrupal-6/includes/locale.incTheme the language overview form.
theme_maintenance_pagedocs-6/theme.phpImplemented using the maintenance-page.tpl.php template.
theme_markdrupal-6/includes/theme.incReturn a themed marker, useful for marking new or updated content.
theme_menu_itemdrupal-6/includes/menu.incGenerate the HTML output for a menu item and submenu.
theme_menu_item_linkdrupal-6/includes/menu.incGenerate the HTML output for a single menu link.
theme_menu_local_taskdrupal-6/includes/menu.incGenerate the HTML output for a single local task link.
theme_menu_local_tasksdrupal-6/includes/menu.incReturns the rendered local tasks. The default implementation renders them as tabs.
theme_menu_overview_formdrupal-6/modules/menu/menu.admin.incTheme the menu overview form into a table.
theme_menu_treedrupal-6/includes/menu.incGenerate the HTML output for a menu tree
theme_more_help_linkdrupal-6/includes/theme.incReturns code that emits the 'more help'-link.
theme_more_linkdrupal-6/includes/theme.incReturns code that emits the 'more' link used on blocks.
theme_nodedocs-6/theme.phpImplemented using the node.tpl.php template.
theme_node_add_listdrupal-6/modules/node/node.pages.incDisplay the list of available node types for node creation.
theme_node_admin_nodesdrupal-6/modules/node/node.admin.incTheme node administration overview.
theme_node_filtersdrupal-6/modules/node/node.admin.incTheme node administration filter selector.
theme_node_filter_formdrupal-6/modules/node/node.admin.incTheme node administration filter form.
theme_node_formdrupal-6/modules/node/node.pages.incPresent a node submission form.
theme_node_listdrupal-6/modules/node/node.moduleFormat a listing of links to nodes.
theme_node_log_messagedrupal-6/modules/node/node.moduleTheme a log message.
theme_node_previewdrupal-6/modules/node/node.pages.incDisplay a node preview for display during node creation and editing.
theme_node_search_admindrupal-6/modules/node/node.moduleTheme the content ranking part of the search settings admin page.
theme_node_submitteddrupal-6/modules/node/node.moduleFormat the "Submitted by username on date/time" for each node
theme_pagedocs-6/theme.phpImplemented using the page.tpl.php template.
theme_pagerdrupal-6/includes/pager.incFormat a query pager.
theme_pager_firstdrupal-6/includes/pager.incFormat a "first page" link.
theme_pager_lastdrupal-6/includes/pager.incFormat a "last page" link.
theme_pager_linkdrupal-6/includes/pager.incFormat a link to a specific query result page.
theme_pager_nextdrupal-6/includes/pager.incFormat a "next page" link.
theme_pager_previousdrupal-6/includes/pager.incFormat a "previous page" link.
theme_panels_block_style_render_panecontrib-6/panels/plugins/styles/block.incRender callback.
theme_panels_default_style_render_regioncontrib-6/panels/plugins/styles/default.incRender callback.
theme_panels_list_style_render_regioncontrib-6/panels/plugins/styles/list.incRender callback.
theme_panels_naked_style_render_panecontrib-6/panels/plugins/styles/naked.incRender callback.
theme_panels_rounded_corners_style_render_regioncontrib-6/panels/plugins/styles/corners/rounded_corners.incRender callback.
theme_passworddrupal-6/includes/form.incFormat a password field.
theme_password_confirmdrupal-6/includes/form.incFormat a password_confirm item.
theme_placeholderdrupal-6/includes/theme.incFormats text for emphasized display in a placeholder inside a sentence. Used automatically by t().
theme_poll_bardocs-6/theme.phpImplemented using the poll-bar.tpl.php template.
theme_poll_bar_blockdocs-6/theme.phpImplemented using the poll-bar-block.tpl.php template.
theme_poll_choicesdrupal-6/modules/poll/poll.moduleTheme the admin poll form for choices.
theme_poll_resultsdocs-6/theme.phpImplemented using the poll-results.tpl.php template.
theme_poll_results_blockdocs-6/theme.phpImplemented using the poll-results-block.tpl.php template.
theme_poll_votedocs-6/theme.phpImplemented using the poll-vote.tpl.php template.
theme_pricecontrib-6/ecommerce/ec_product/ec_product.theme.inc
theme_profile_admin_overviewdrupal-6/modules/profile/profile.admin.incTheme the profile field overview into a drag and drop enabled table.
theme_profile_blockdocs-6/theme.phpImplemented using the profile-block.tpl.php template.
theme_profile_listingdocs-6/theme.phpImplemented using the profile-listing.tpl.php template.
theme_profile_wrapperdocs-6/theme.phpImplemented using the profile-wrapper.tpl.php template.
theme_progress_bardrupal-6/includes/theme.incReturn a themed progress bar.
theme_radiodrupal-6/includes/form.incFormat a radio button.
theme_radiosdrupal-6/includes/form.incFormat a set of radio buttons.
theme_scaffolding_example_overview_formcontrib-6/examples/scaffolding_example/scaffolding_example.admin.incTheme the drag-and-drop overview form.
theme_scaffolding_example_recordcontrib-6/examples/scaffolding_example/scaffolding_example.pages.incTheme a single record.
theme_search_block_formdocs-6/theme.phpImplemented using the search-block-form.tpl.php template.
theme_search_resultdocs-6/theme.phpImplemented using the search-result.tpl.php template.
theme_search_resultsdocs-6/theme.phpImplemented using the search-results.tpl.php template.
theme_search_theme_formdocs-6/theme.phpImplemented using the search-theme-form.tpl.php template.
theme_selectdrupal-6/includes/form.incFormat a dropdown menu or scrolling selection box.
theme_status_messagesdrupal-6/includes/theme.incReturn a themed set of status and/or error messages. The messages are grouped by type.
theme_status_reportdrupal-6/modules/system/system.admin.incTheme requirements status report.
theme_submenudrupal-6/includes/theme.incReturn a themed submenu, typically displayed under the tabs.
theme_submitdrupal-6/includes/form.incTheme a form submit button.
theme_subscriptions_form_tablecontrib-6/subscriptions/subscriptions.admin.incTheme subscriptions page controls table.
theme_subscriptions_ui_tablecontrib-6/subscriptions/subscriptions_ui.moduleTheme subscriptions node subform table.
theme_syslog_formatdrupal-6/modules/syslog/syslog.moduleFormat a system log entry.
theme_system_admin_by_moduledrupal-6/modules/system/system.admin.incTheme output of the dashboard page.
theme_system_modulesdrupal-6/modules/system/system.admin.incTheme callback for the modules form.
theme_system_modules_uninstalldrupal-6/modules/system/system.admin.incThemes a table of currently disabled modules.
theme_system_powered_bydrupal-6/modules/system/system.moduleFormat the Powered by Drupal text.
theme_system_themes_formdrupal-6/modules/system/system.admin.incTheme function for the system themes form.
theme_system_theme_select_formdrupal-6/modules/system/system.admin.incTheme the theme select form.
theme_tabledrupal-6/includes/theme.incReturn a themed table.
theme_tablesort_indicatordrupal-6/includes/theme.incReturn a themed sort icon.
theme_table_select_header_celldrupal-6/includes/theme.incReturns a header cell for tables that have a select all functionality.
theme_task_listdrupal-6/includes/theme.maintenance.incReturn a themed list of maintenance tasks to perform.
theme_taxonomy_overview_termsdrupal-6/modules/taxonomy/taxonomy.admin.incTheme the terms overview as a sortable list of terms.
theme_taxonomy_overview_vocabulariesdrupal-6/modules/taxonomy/taxonomy.admin.incTheme the vocabulary overview as a sortable list of vocabularies.
theme_taxonomy_term_pagedrupal-6/modules/taxonomy/taxonomy.pages.incRender a taxonomy term page HTML output.
theme_taxonomy_term_selectdrupal-6/modules/taxonomy/taxonomy.moduleFormat the selection field for choosing terms (by deafult the default selection field is used).
theme_textareadrupal-6/includes/form.incFormat a textarea.
theme_textfielddrupal-6/includes/form.incFormat a textfield.
theme_tokendrupal-6/includes/form.incFormat a form token.
theme_trigger_displaydrupal-6/modules/trigger/trigger.admin.incDisplay actions assigned to this hook-op combination in a table.
theme_update_reportdrupal-6/modules/update/update.report.incTheme project status report.
theme_update_versiondrupal-6/modules/update/update.report.incTheme the version display of a project.
theme_upload_attachmentsdrupal-6/modules/upload/upload.moduleDisplays file attachments in table
theme_upload_form_currentdrupal-6/modules/upload/upload.moduleTheme the attachments list.
theme_upload_form_newdrupal-6/modules/upload/upload.moduleTheme the attachment form. Note: required to output prefix/suffix.
theme_usernamedrupal-6/includes/theme.incFormat a username.
theme_user_admin_accountdrupal-6/modules/user/user.admin.incTheme user administration overview.
theme_user_admin_new_roledrupal-6/modules/user/user.admin.incTheme the new-role form.
theme_user_admin_permdrupal-6/modules/user/user.admin.incTheme the administer permissions page.
theme_user_filtersdrupal-6/modules/user/user.admin.incTheme user administration filter selector.
theme_user_filter_formdrupal-6/modules/user/user.admin.incTheme user administration filter form.
theme_user_listdrupal-6/modules/user/user.moduleMake a list of users.
theme_user_picturedocs-6/theme.phpImplemented using the user-picture.tpl.php template.
theme_user_profiledocs-6/theme.phpImplemented using the user-profile.tpl.php template.
theme_user_profile_categorydocs-6/theme.phpImplemented using the user-profile-category.tpl.php template.
theme_user_profile_itemdocs-6/theme.phpImplemented using the user-profile-item.tpl.php template.
theme_user_signaturedrupal-6/modules/user/user.moduleTheme output of user signature.
theme_xml_icondrupal-6/includes/theme.incReturn code that emits an XML icon.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options