Default theme implementations

  1. 7.x drupal-7.x/modules/system/theme.api.php themeable
  2. 6.x drupal-6.x/includes/theme.inc themeable

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()

hook_theme()

File

drupal-6.x/includes/theme.inc, line 1085
The theme system, which controls the output of Drupal.

Functions

Namesort descending Location Description
phptemplate_menu_local_tasks drupal-6.x/themes/garland/template.php Returns the rendered local tasks. The default implementation renders them as tabs. Overridden to split the secondary tasks.
theme_admin_block drupal-6.x/modules/system/system.admin.inc This function formats an administrative block for display.
theme_admin_block_content drupal-6.x/modules/system/system.admin.inc This function formats the content of an administrative block.
theme_admin_page drupal-6.x/modules/system/system.admin.inc This function formats an administrative page for viewing.
theme_aggregator_block_item drupal-6.x/modules/aggregator/aggregator.module Format an individual feed item for display in the block.
theme_aggregator_categorize_items drupal-6.x/modules/aggregator/aggregator.pages.inc Theme the page list form for assigning categories.
theme_aggregator_feed_source documentation-6.x/developer/theme.php Implemented using the aggregator-feed-source.tpl.php template.
theme_aggregator_item documentation-6.x/developer/theme.php Implemented using the aggregator-item.tpl.php template.
theme_aggregator_page_opml drupal-6.x/modules/aggregator/aggregator.pages.inc Theme the OPML feed output.
theme_aggregator_page_rss drupal-6.x/modules/aggregator/aggregator.pages.inc Theme the RSS output.
theme_aggregator_summary_item documentation-6.x/developer/theme.php Implemented using the aggregator-summary-item.tpl.php template.
theme_aggregator_summary_items documentation-6.x/developer/theme.php Implemented using the aggregator-summary-items.tpl.php template.
theme_aggregator_wrapper documentation-6.x/developer/theme.php Implemented using the aggregator-wrapper.tpl.php template.
theme_block documentation-6.x/developer/theme.php Implemented using the block.tpl.php template.
theme_blocks drupal-6.x/includes/theme.inc Return a set of blocks available for the current user.
theme_block_admin_display_form documentation-6.x/developer/theme.php Implemented using the block-admin-display-form.tpl.php template.
theme_book_admin_table drupal-6.x/modules/book/book.admin.inc Theme function for the book administration page form.
theme_book_all_books_block documentation-6.x/developer/theme.php Implemented using the book-all-books-block.tpl.php template.
theme_book_export_html documentation-6.x/developer/theme.php Implemented using the book-export-html.tpl.php template.
theme_book_navigation documentation-6.x/developer/theme.php Implemented using the book-navigation.tpl.php template.
theme_book_node_export_html documentation-6.x/developer/theme.php Implemented using the book-node-export-html.tpl.php template.
theme_book_title_link drupal-6.x/modules/book/book.module Generate the HTML output for a link to a book title when used as a block title.
theme_box drupal-6.x/includes/theme.inc Return a themed box.
theme_breadcrumb drupal-6.x/includes/theme.inc Return a themed breadcrumb trail.
theme_button drupal-6.x/includes/form.inc Theme a form button.
theme_checkbox drupal-6.x/includes/form.inc Format a checkbox.
theme_checkboxes drupal-6.x/includes/form.inc Format a set of checkboxes.
theme_closure drupal-6.x/includes/theme.inc Execute hook_footer() which is run at the end of the page right before the close of the body tag.
theme_color_scheme_form drupal-6.x/modules/color/color.module Theme color form.
theme_comment documentation-6.x/developer/theme.php Implemented using the comment.tpl.php template.
theme_comment_admin_overview drupal-6.x/modules/comment/comment.admin.inc Theme the comment admin form.
theme_comment_block drupal-6.x/modules/comment/comment.module Returns a formatted list of recent comments to be displayed in the comment block.
theme_comment_controls drupal-6.x/modules/comment/comment.module Theme comment controls box where the user can change the default display mode and display order of comments.
theme_comment_flat_collapsed drupal-6.x/modules/comment/comment.module Theme comment flat collapsed view.
theme_comment_flat_expanded drupal-6.x/modules/comment/comment.module Theme comment flat expanded view.
theme_comment_folded documentation-6.x/developer/theme.php Implemented using the comment-folded.tpl.php template.
theme_comment_post_forbidden drupal-6.x/modules/comment/comment.module Theme a "you can't post comments" notice.
theme_comment_submitted drupal-6.x/modules/comment/comment.module Theme a "Submitted by ..." notice.
theme_comment_thread_collapsed drupal-6.x/modules/comment/comment.module Theme comment thread collapsed view.
theme_comment_thread_expanded drupal-6.x/modules/comment/comment.module Theme comment thread expanded view.
theme_comment_view drupal-6.x/modules/comment/comment.module Themes a single comment and related items.
theme_comment_wrapper documentation-6.x/developer/theme.php Implemented using the comment-wrapper.tpl.php template.
theme_date drupal-6.x/includes/form.inc Format a date selection element.
theme_dblog_filters drupal-6.x/modules/dblog/dblog.module Theme dblog administration filter selector.
theme_feed_icon drupal-6.x/includes/theme.inc Return code that emits an feed icon.
theme_fieldset drupal-6.x/includes/form.inc Format a group of form items.
theme_file drupal-6.x/includes/form.inc Format a file upload field.
theme_filter_admin_order drupal-6.x/modules/filter/filter.admin.inc Theme filter order configuration form.
theme_filter_admin_overview drupal-6.x/modules/filter/filter.admin.inc Theme the admin overview form.
theme_filter_tips drupal-6.x/modules/filter/filter.pages.inc Format a set of filter tips.
theme_filter_tips_more_info drupal-6.x/modules/filter/filter.module Format a link to the more extensive filter tips.
theme_form drupal-6.x/includes/form.inc Format a form.
theme_form_element drupal-6.x/includes/form.inc Return a themed form element.
theme_forums documentation-6.x/developer/theme.php Implemented using the forums.tpl.php template.
theme_forum_icon documentation-6.x/developer/theme.php Implemented using the forum-icon.tpl.php template.
theme_forum_list documentation-6.x/developer/theme.php Implemented using the forum-list.tpl.php template.
theme_forum_submitted documentation-6.x/developer/theme.php Implemented using the forum-submitted.tpl.php template.
theme_forum_topic_list documentation-6.x/developer/theme.php Implemented using the forum-topic-list.tpl.php template.
theme_forum_topic_navigation documentation-6.x/developer/theme.php Implemented using the forum-topic-navigation.tpl.php template.
theme_help drupal-6.x/includes/theme.inc Return a themed help message.
theme_hidden drupal-6.x/includes/form.inc Format a hidden form field.
theme_image drupal-6.x/includes/theme.inc Return a themed image.
theme_image_button drupal-6.x/includes/form.inc Theme a form image button.
theme_indentation drupal-6.x/includes/theme.inc Create a standard indentation div. Used for drag and drop tables.
theme_item drupal-6.x/includes/form.inc Format a form item.
theme_item_list drupal-6.x/includes/theme.inc Return a themed list of items.
theme_links drupal-6.x/includes/theme.inc Returns HTML for a set of links.
theme_locale_languages_overview_form drupal-6.x/includes/locale.inc Theme the language overview form.
theme_maintenance_page documentation-6.x/developer/theme.php Implemented using the maintenance-page.tpl.php template.
theme_mark drupal-6.x/includes/theme.inc Return a themed marker, useful for marking new or updated content.
theme_menu_item drupal-6.x/includes/menu.inc Generate the HTML output for a menu item and submenu.
theme_menu_item_link drupal-6.x/includes/menu.inc Generate the HTML output for a single menu link.
theme_menu_local_task drupal-6.x/includes/menu.inc Generate the HTML output for a single local task link.
theme_menu_local_tasks drupal-6.x/includes/menu.inc Returns the rendered local tasks. The default implementation renders them as tabs.
theme_menu_overview_form drupal-6.x/modules/menu/menu.admin.inc Theme the menu overview form into a table.
theme_menu_tree drupal-6.x/includes/menu.inc Generate the HTML output for a menu tree
theme_more_help_link drupal-6.x/includes/theme.inc Returns code that emits the 'more help'-link.
theme_more_link drupal-6.x/includes/theme.inc Returns code that emits the 'more' link used on blocks.
theme_node documentation-6.x/developer/theme.php Implemented using the node.tpl.php template.
theme_node_add_list drupal-6.x/modules/node/node.pages.inc Display the list of available node types for node creation.
theme_node_admin_nodes drupal-6.x/modules/node/node.admin.inc Theme node administration overview.
theme_node_filters drupal-6.x/modules/node/node.admin.inc Theme node administration filter selector.
theme_node_filter_form drupal-6.x/modules/node/node.admin.inc Theme node administration filter form.
theme_node_form drupal-6.x/modules/node/node.pages.inc Present a node submission form.
theme_node_list drupal-6.x/modules/node/node.module Format a listing of links to nodes.
theme_node_log_message drupal-6.x/modules/node/node.module Theme a log message.
theme_node_preview drupal-6.x/modules/node/node.pages.inc Display a node preview for display during node creation and editing.
theme_node_search_admin drupal-6.x/modules/node/node.module Theme the content ranking part of the search settings admin page.
theme_node_submitted drupal-6.x/modules/node/node.module Format the "Submitted by username on date/time" for each node
theme_page documentation-6.x/developer/theme.php Implemented using the page.tpl.php template.
theme_pager drupal-6.x/includes/pager.inc Returns HTML for a query pager.
theme_pager_first drupal-6.x/includes/pager.inc Returns HTML for a "first page" link.
theme_pager_last drupal-6.x/includes/pager.inc Returns HTML for a "last page" link.
theme_pager_link drupal-6.x/includes/pager.inc Returns HTML for a link to a specific query result page.
theme_pager_next drupal-6.x/includes/pager.inc Returns HTML for a "next page" link.
theme_pager_previous drupal-6.x/includes/pager.inc Returns HTML for a "previous page" link.
theme_password drupal-6.x/includes/form.inc Format a password field.
theme_password_confirm drupal-6.x/includes/form.inc Format a password_confirm item.
theme_placeholder drupal-6.x/includes/theme.inc Formats text for emphasized display in a placeholder inside a sentence. Used automatically by t().
theme_poll_bar documentation-6.x/developer/theme.php Implemented using the poll-bar.tpl.php template.
theme_poll_bar_block documentation-6.x/developer/theme.php Implemented using the poll-bar-block.tpl.php template.
theme_poll_choices drupal-6.x/modules/poll/poll.module Theme the admin poll form for choices.
theme_poll_results documentation-6.x/developer/theme.php Implemented using the poll-results.tpl.php template.
theme_poll_results_block documentation-6.x/developer/theme.php Implemented using the poll-results-block.tpl.php template.
theme_poll_vote documentation-6.x/developer/theme.php Implemented using the poll-vote.tpl.php template.
theme_profile_admin_overview drupal-6.x/modules/profile/profile.admin.inc Theme the profile field overview into a drag and drop enabled table.
theme_profile_block documentation-6.x/developer/theme.php Implemented using the profile-block.tpl.php template.
theme_profile_listing documentation-6.x/developer/theme.php Implemented using the profile-listing.tpl.php template.
theme_profile_wrapper documentation-6.x/developer/theme.php Implemented using the profile-wrapper.tpl.php template.
theme_progress_bar drupal-6.x/includes/theme.inc Return a themed progress bar.
theme_radio drupal-6.x/includes/form.inc Format a radio button.
theme_radios drupal-6.x/includes/form.inc Format a set of radio buttons.
theme_search_block_form documentation-6.x/developer/theme.php Implemented using the search-block-form.tpl.php template.
theme_search_result documentation-6.x/developer/theme.php Implemented using the search-result.tpl.php template.
theme_search_results documentation-6.x/developer/theme.php Implemented using the search-results.tpl.php template.
theme_search_theme_form documentation-6.x/developer/theme.php Implemented using the search-theme-form.tpl.php template.
theme_select drupal-6.x/includes/form.inc Format a dropdown menu or scrolling selection box.
theme_status_messages drupal-6.x/includes/theme.inc Return a themed set of status and/or error messages. The messages are grouped by type.
theme_status_report drupal-6.x/modules/system/system.admin.inc Theme requirements status report.
theme_submenu drupal-6.x/includes/theme.inc Return a themed submenu, typically displayed under the tabs.
theme_submit drupal-6.x/includes/form.inc Theme a form submit button.
theme_syslog_format drupal-6.x/modules/syslog/syslog.module Format a system log entry.
theme_system_admin_by_module drupal-6.x/modules/system/system.admin.inc Theme output of the dashboard page.
theme_system_modules drupal-6.x/modules/system/system.admin.inc Theme callback for the modules form.
theme_system_modules_uninstall drupal-6.x/modules/system/system.admin.inc Themes a table of currently disabled modules.
theme_system_powered_by drupal-6.x/modules/system/system.module Format the Powered by Drupal text.
theme_system_themes_form drupal-6.x/modules/system/system.admin.inc Theme function for the system themes form.
theme_system_theme_select_form drupal-6.x/modules/system/system.admin.inc Theme the theme select form.
theme_table drupal-6.x/includes/theme.inc Return a themed table.
theme_tablesort_indicator drupal-6.x/includes/theme.inc Return a themed sort icon.
theme_table_select_header_cell drupal-6.x/includes/theme.inc Returns a header cell for tables that have a select all functionality.
theme_task_list drupal-6.x/includes/theme.maintenance.inc Return a themed list of maintenance tasks to perform.
theme_taxonomy_overview_terms drupal-6.x/modules/taxonomy/taxonomy.admin.inc Theme the terms overview as a sortable list of terms.
theme_taxonomy_overview_vocabularies drupal-6.x/modules/taxonomy/taxonomy.admin.inc Theme the vocabulary overview as a sortable list of vocabularies.
theme_taxonomy_term_page drupal-6.x/modules/taxonomy/taxonomy.pages.inc Render a taxonomy term page HTML output.
theme_taxonomy_term_select drupal-6.x/modules/taxonomy/taxonomy.module Format the selection field for choosing terms (by deafult the default selection field is used).
theme_textarea drupal-6.x/includes/form.inc Format a textarea.
theme_textfield drupal-6.x/includes/form.inc Format a textfield.
theme_token drupal-6.x/includes/form.inc Format a form token.
theme_trigger_display drupal-6.x/modules/trigger/trigger.admin.inc Display actions assigned to this hook-op combination in a table.
theme_update_report drupal-6.x/modules/update/update.report.inc Theme project status report.
theme_update_version drupal-6.x/modules/update/update.report.inc Theme the version display of a project.
theme_upload_attachments drupal-6.x/modules/upload/upload.module Displays file attachments in table
theme_upload_form_current drupal-6.x/modules/upload/upload.module Theme the attachments list.
theme_upload_form_new drupal-6.x/modules/upload/upload.module Theme the attachment form. Note: required to output prefix/suffix.
theme_username drupal-6.x/includes/theme.inc Format a username.
theme_user_admin_account drupal-6.x/modules/user/user.admin.inc Theme user administration overview.
theme_user_admin_new_role drupal-6.x/modules/user/user.admin.inc Theme the new-role form.
theme_user_admin_perm drupal-6.x/modules/user/user.admin.inc Theme the administer permissions page.
theme_user_filters drupal-6.x/modules/user/user.admin.inc Theme user administration filter selector.
theme_user_filter_form drupal-6.x/modules/user/user.admin.inc Theme user administration filter form.
theme_user_list drupal-6.x/modules/user/user.module Make a list of users.
theme_user_picture documentation-6.x/developer/theme.php Implemented using the user-picture.tpl.php template.
theme_user_profile documentation-6.x/developer/theme.php Implemented using the user-profile.tpl.php template.
theme_user_profile_category documentation-6.x/developer/theme.php Implemented using the user-profile-category.tpl.php template.
theme_user_profile_item documentation-6.x/developer/theme.php Implemented using the user-profile-item.tpl.php template.
theme_user_signature drupal-6.x/modules/user/user.module Theme output of user signature.
theme_xml_icon drupal-6.x/includes/theme.inc Return code that emits an XML icon.

Files

Namesort descending Location Description
theme.inc drupal-6.x/includes/theme.inc The theme system, which controls the output of Drupal.