Default theme implementations

Functions and templates for the user interface to 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 Twig. Drupal's theme engines can provide alternate template engines, such as XTemplate, Smarty and PHPTal.

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 is that theme functions should be named THEMENAME_HOOK. For example, for Drupal's default theme (Bartik) to implement the 'table' hook, the theme function should be called bartik_table().

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

End of "defgroup themeable".

See also

theme()

hook_theme()

Hooks

Callbacks

File

drupal/core/modules/system/theme.api.php, line 3

Functions

Namesort ascending Location Description
theme_vertical_tabs drupal/core/includes/form.inc Returns HTML for an element's children details as vertical tabs.
theme_user_signature drupal/core/modules/user/user.module Returns HTML for a user signature.
theme_user_permission_description drupal/core/modules/user/user.admin.inc Returns HTML for an individual permission description.
theme_user_admin_permissions drupal/core/modules/user/user.admin.inc Returns HTML for the administer permissions page.
theme_update_version drupal/core/modules/update/update.report.inc Returns HTML for the version display of a project.
theme_update_status_label drupal/core/modules/update/update.report.inc Returns HTML for a label to display for a project's update status.
theme_update_report drupal/core/modules/update/update.report.inc Returns HTML for the project status report.
theme_update_manager_update_form drupal/core/modules/update/update.manager.inc Returns HTML for the first page in the process of updating projects.
theme_update_last_check drupal/core/modules/update/update.module Returns HTML for the last time we checked for update data.
theme_text_format_wrapper drupal/core/modules/filter/filter.module Returns HTML for a text format-enabled form element.
theme_textarea drupal/core/includes/form.inc Returns HTML for a textarea form element.
theme_task_list drupal/core/includes/theme.maintenance.inc Returns HTML for a list of maintenance tasks to perform.
theme_tablesort_indicator drupal/core/includes/theme.inc Returns HTML for a sort icon.
theme_tableselect drupal/core/includes/form.inc Returns HTML for a table with radio buttons or checkboxes.
theme_table drupal/core/includes/theme.inc Returns HTML for a table.
theme_system_themes_page drupal/core/modules/system/system.admin.inc Returns HTML for the Appearance page.
theme_system_powered_by drupal/core/modules/system/system.module Returns HTML for the Powered by Drupal text.
theme_system_modules_uninstall drupal/core/modules/system/system.admin.inc Returns HTML for a table of currently disabled modules.
theme_system_modules_incompatible drupal/core/modules/system/system.admin.inc Returns HTML for a message about incompatible modules.
theme_system_modules_details drupal/core/modules/system/system.admin.inc Returns HTML for the modules form.
theme_system_date_format_localize_form drupal/core/modules/system/system.admin.inc Returns HTML for a locale date format form.
theme_system_config_form drupal/core/modules/system/system.module Returns HTML for a system settings form.
theme_system_compact_link drupal/core/modules/system/system.module Returns HTML for a link to show or hide inline help descriptions.
theme_system_admin_index drupal/core/modules/system/system.admin.inc Returns HTML for the output of the admin index page.
theme_status_report drupal/core/modules/system/system.admin.inc Returns HTML for the status report.
theme_status_messages drupal/core/includes/theme.inc Returns HTML for status and/or error messages, grouped by type.
theme_simpletest_test_table drupal/core/modules/simpletest/simpletest.theme.inc Returns HTML for a test list generated by simpletest_test_form() into a table.
theme_simpletest_result_summary drupal/core/modules/simpletest/simpletest.theme.inc Returns HTML for the summary status of a simpletest result.
theme_shortcut_set_customize drupal/core/modules/shortcut/shortcut.admin.inc Returns HTML for a shortcut set customization form.
theme_select drupal/core/includes/form.inc Returns HTML for a select form element.
theme_rdf_template_variable_wrapper drupal/core/modules/rdf/rdf.module Returns HTML for a template variable wrapped in an HTML element with the RDF attributes.
theme_rdf_metadata drupal/core/modules/rdf/rdf.module Returns HTML for a series of empty spans for exporting RDF metadata in RDFa.
theme_radios drupal/core/includes/form.inc Returns HTML for a set of radio button form elements.
theme_progress_bar drupal/core/includes/theme.inc Returns HTML for a progress bar.
theme_picture_source drupal/core/modules/picture/picture.module Returns HTML for a source tag.
theme_picture_formatter drupal/core/modules/picture/picture.module Returns HTML for a picture field formatter.
theme_picture drupal/core/modules/picture/picture.module Returns HTML for a picture.
theme_pager_link drupal/core/includes/pager.inc Returns HTML for a link to a specific query result page.
theme_pager drupal/core/includes/pager.inc Returns HTML for a query pager.
theme_node_search_admin drupal/core/modules/node/node.module Returns HTML for the content ranking part of the search settings admin page.
theme_node_recent_content drupal/core/modules/node/node.module Returns HTML for a recent node to be displayed in the recent content block.
theme_node_recent_block drupal/core/modules/node/node.module Returns HTML for a list of recent content.
theme_node_preview drupal/core/modules/node/node.pages.inc Returns HTML for a node preview for display during node creation and editing.
theme_node_admin_overview drupal/core/modules/node/content_types.inc Returns HTML for a node type description for the content type admin page.
theme_node_add_list drupal/core/modules/node/node.pages.inc Returns HTML for a list of available node types for node creation.
theme_more_link drupal/core/includes/theme.inc Returns HTML for a "more" link, like those used in blocks.
theme_more_help_link drupal/core/includes/theme.inc Returns HTML for a "more help" link.
theme_meter drupal/core/includes/theme.inc Returns HTML for a meter.
theme_menu_tree drupal/core/includes/menu.inc Returns HTML for a wrapper for a menu sub-tree.
theme_menu_overview_form drupal/core/modules/menu/menu.admin.inc Returns HTML for the menu overview form into a table.
theme_menu_local_tasks drupal/core/includes/menu.inc Returns HTML for primary and secondary local tasks.
theme_menu_local_task drupal/core/includes/menu.inc Returns HTML for a single local task link.
theme_menu_local_action drupal/core/includes/menu.inc Returns HTML for a single local action link.
theme_menu_link drupal/core/includes/menu.inc Returns HTML for a menu link and submenu.
theme_mark drupal/core/includes/theme.inc Returns HTML for a marker for new or updated content.
theme_locale_translation_update_info drupal/core/modules/locale/locale.pages.inc Returns HTML for translation status information per language.
theme_locale_translation_last_check drupal/core/modules/locale/locale.pages.inc Returns HTML for the last time we checked for update data.
theme_locale_translate_edit_form_strings drupal/core/modules/locale/locale.pages.inc Returns HTML for translation edit form.
theme_links drupal/core/includes/theme.inc Returns HTML for a set of links.
theme_link drupal/core/includes/theme.inc Returns HTML for a link.
theme_language_negotiation_configure_form drupal/core/modules/language/language.admin.inc Returns HTML for the language negotiation configuration form.
theme_language_negotiation_configure_browser_form_table drupal/core/modules/language/language.admin.inc Theme browser configuration form as table.
theme_item_list drupal/core/includes/theme.inc Returns HTML for a list or nested list of items.
theme_input drupal/core/includes/form.inc Returns HTML for an input form element.
theme_indentation drupal/core/includes/theme.inc Returns HTML for an indentation div; used for drag and drop tables.
theme_image_widget drupal/core/modules/image/image.field.inc Returns HTML for an image field widget.
theme_image_style_preview drupal/core/modules/image/image.admin.inc Returns HTML for a preview of an image style.
theme_image_style_list drupal/core/modules/image/image.admin.inc Returns HTML for the page containing the list of image styles.
theme_image_style_effects drupal/core/modules/image/image.admin.inc Returns HTML for a listing of the effects within a specific image style.
theme_image_style drupal/core/modules/image/image.module Returns HTML for an image using a specific image style.
theme_image_scale_summary drupal/core/modules/image/image.admin.inc Returns HTML for a summary of an image scale effect.
theme_image_rotate_summary drupal/core/modules/image/image.admin.inc Returns HTML for a summary of an image rotate effect.
theme_image_resize_summary drupal/core/modules/image/image.admin.inc Returns HTML for a summary of an image resize effect.
theme_image_formatter drupal/core/modules/image/image.field.inc Returns HTML for an image field formatter.
theme_image_crop_summary drupal/core/modules/image/image.admin.inc Returns HTML for a summary of an image crop effect.
theme_image_anchor drupal/core/modules/image/image.admin.inc Returns HTML for a 3x3 grid of checkboxes for image anchors.
theme_image drupal/core/includes/theme.inc Returns HTML for an image.
theme_forum_form drupal/core/modules/forum/forum.admin.inc Returns HTML for a forum form.
theme_form_required_marker drupal/core/includes/form.inc Returns HTML for a marker for required form elements.
theme_form_element_label drupal/core/includes/form.inc Returns HTML for a form element label and required marker.
theme_form_element drupal/core/includes/form.inc Returns HTML for a form element.
theme_form drupal/core/includes/form.inc Returns HTML for a form.
theme_filter_tips drupal/core/modules/filter/filter.pages.inc Returns HTML for a set of filter tips.
theme_filter_html_image_secure_image drupal/core/modules/filter/filter.module Formats an image DOM element that has an invalid source.
theme_filter_guidelines drupal/core/modules/filter/filter.module Returns HTML for guidelines for a text format.
theme_file_widget_multiple drupal/core/modules/file/file.field.inc Returns HTML for a group of file upload widgets.
theme_file_widget drupal/core/modules/file/file.field.inc Returns HTML for an individual file upload widget.
theme_file_upload_help drupal/core/modules/file/file.field.inc Returns HTML for help text based on file upload validators.
theme_file_managed_file drupal/core/modules/file/file.module Returns HTML for a managed file element.
theme_file_link drupal/core/modules/file/file.module Returns HTML for a link to a file.
theme_file_icon drupal/core/modules/file/file.module Returns HTML for an image with an appropriate icon for the given file.
theme_file_formatter_table drupal/core/modules/file/file.field.inc Returns HTML for a file attachments table.
theme_field_ui_table drupal/core/modules/field_ui/field_ui.admin.inc Returns HTML for Field UI overview tables.
theme_field_multiple_value_form drupal/core/modules/field/field.form.inc Returns HTML for an individual form element.
theme_fieldset drupal/core/includes/form.inc Returns HTML for a fieldset form element and its children.
theme_field drupal/core/modules/field/field.module Returns HTML for a field.
theme_feed_icon drupal/core/includes/theme.inc Returns HTML for a feed icon.
theme_exposed_filters drupal/core/modules/system/system.module Returns HTML for an exposed filter form.
theme_dropbutton_wrapper drupal/core/includes/theme.inc Returns HTML for wrapping a dropbutton menu.
theme_details drupal/core/includes/form.inc Returns HTML for a details form element and its children.
theme_datetime_wrapper drupal/core/modules/datetime/datetime.module Returns HTML for a datetime form element.
theme_datetime_form drupal/core/modules/datetime/datetime.module Returns HTML for a HTML5-compatible #datetime form element.
theme_datetime drupal/core/includes/theme.inc Returns HTML for a date / time.
theme_datelist_form drupal/core/modules/datetime/datetime.module Returns HTML for a date selection form element.
theme_date drupal/core/includes/form.inc Returns HTML for an #date form element.
theme_container drupal/core/includes/form.inc Returns HTML to wrap child elements in a container.
theme_confirm_form drupal/core/modules/system/system.module Returns HTML for a confirmation form.
theme_comment_post_forbidden drupal/core/modules/comment/comment.module Returns HTML for a "you can't post comments" notice.
theme_comment_block drupal/core/modules/comment/comment.module Returns HTML for a list of recent comments.
theme_checkboxes drupal/core/includes/form.inc Returns HTML for a set of checkbox form elements.
theme_breadcrumb drupal/core/includes/theme.inc Returns HTML for a breadcrumb trail.
theme_book_admin_table drupal/core/modules/book/book.admin.inc Returns HTML for a book administration form.
theme_authorize_report drupal/core/includes/theme.maintenance.inc Returns HTML for a results report of an operation run by authorize.php.
theme_authorize_message drupal/core/includes/theme.maintenance.inc Returns HTML for a single log message from the authorize.php batch operation.
theme_aggregator_page_rss drupal/core/modules/aggregator/aggregator.pages.inc Prints the RSS page for a feed.
theme_aggregator_page_opml drupal/core/modules/aggregator/aggregator.pages.inc Prints the OPML page for the feed.
theme_aggregator_block_item drupal/core/modules/aggregator/aggregator.module Returns HTML for an individual feed item for display in the block.
theme_admin_page drupal/core/modules/system/system.admin.inc Returns HTML for an administrative page.
theme_admin_block_content drupal/core/modules/system/system.admin.inc Returns HTML for the content of an administrative block.
theme_admin_block drupal/core/modules/system/system.admin.inc Returns HTML for an administrative block for display.
template_preprocess_item_list drupal/core/includes/theme.inc Preprocesses variables for theme_item_list().
template_preprocess_input drupal/core/includes/form.inc Preprocesses variables for theme_input().
template_preprocess_datetime drupal/core/includes/theme.inc Preprocess variables for theme_datetime().
drupal_pre_render_table drupal/core/includes/theme.inc #pre_render callback to transform children of an element into #rows suitable for theme_table().

Files

Namesort ascending Location Description
views-view.html.twig drupal/core/modules/views/templates/views-view.html.twig Default theme implementation for main view template.
views-view-unformatted.html.twig drupal/core/modules/views/templates/views-view-unformatted.html.twig Default theme implementation to display a view of unformatted rows.
views-view-table.html.twig drupal/core/modules/views/templates/views-view-table.html.twig Default theme implementation for displaying a view as a table.
views-view-summary.html.twig drupal/core/modules/views/templates/views-view-summary.html.twig Default theme implementation to display a list of summary lines.
views-view-summary-unformatted.html.twig drupal/core/modules/views/templates/views-view-summary-unformatted.html.twig Default theme implementation for unformatted summary links.
views-view-rss.html.twig drupal/core/modules/views/templates/views-view-rss.html.twig Default template for feed displays that use the RSS style.
views-view-row-rss.html.twig drupal/core/modules/views/templates/views-view-row-rss.html.twig Default theme implementation to display an item in a views RSS feed.
views-view-list.html.twig drupal/core/modules/views/templates/views-view-list.html.twig Default theme implementation for a view template to display a list of rows.
views-view-grouping.html.twig drupal/core/modules/views/templates/views-view-grouping.html.twig Default theme implementation to display a single views grouping.
views-view-grid.html.twig drupal/core/modules/views/templates/views-view-grid.html.twig Default theme implementation for views to display rows in a grid.
views-view-fields.html.twig drupal/core/modules/views/templates/views-view-fields.html.twig Default view template to display all the fields in a row.
views-view-field.html.twig drupal/core/modules/views/templates/views-view-field.html.twig Default theme implementation for a single field in a view.
views-view--frontpage.html.twig drupal/core/modules/views/tests/views_test_data/templates/views-view--frontpage.html.twig Default theme implementation for the frontpage view template.
views-ui-display-tab-setting.html.twig drupal/core/modules/views_ui/templates/views-ui-display-tab-setting.html.twig Default theme implementation for Views UI display tab settings.
views-ui-display-tab-bucket.html.twig drupal/core/modules/views_ui/templates/views-ui-display-tab-bucket.html.twig Default theme implementation for each "box" on the display query edit screen.
views-more.html.twig drupal/core/modules/views/templates/views-more.html.twig Default theme implementation for a views "more" link.
views-exposed-form.html.twig drupal/core/modules/views/templates/views-exposed-form.html.twig Default theme implementation of a views exposed form.
user.html.twig drupal/core/modules/user/templates/user.html.twig Default theme implementation to present all user data.
two-col.html.twig drupal/core/modules/layout/layouts/static/twocol/two-col.html.twig Template for a 2 column layout.
two-col.html.twig drupal/core/modules/layout/tests/themes/layout_test_theme/layouts/static/two-col/two-col.html.twig Template for a 2 column layout.
taxonomy-term.html.twig drupal/core/modules/taxonomy/templates/taxonomy-term.html.twig Default theme implementation to display a taxonomy term.
system-plugin-ui-form.html.twig drupal/core/modules/system/templates/system-plugin-ui-form.html.twig Default theme implementation to configure blocks.
search-results.html.twig drupal/core/modules/search/templates/search-results.html.twig Default theme implementation for displaying search results.
search-result.html.twig drupal/core/modules/search/templates/search-result.html.twig Default theme implementation for displaying a single search result.
region.html.twig drupal/core/modules/system/templates/region.html.twig Default theme implementation to display a region.
page.html.twig drupal/core/modules/system/templates/page.html.twig Default theme implementation to display a single page.
page.html.twig drupal/core/themes/seven/templates/page.html.twig Seven's theme implementation to display a single Drupal page.
page.html.twig drupal/core/themes/bartik/templates/page.html.twig Bartik's theme implementation to display a single page.
overlay.html.twig drupal/core/modules/overlay/templates/overlay.html.twig Default theme implementation to display a page in the overlay.
overlay-disable-message.html.twig drupal/core/modules/overlay/templates/overlay-disable-message.html.twig Default theme implementation for the message about disabling the overlay.
one-col.html.twig drupal/core/modules/layout/layouts/static/one-col/one-col.html.twig Template for a 1 column layout.
one-col.html.twig drupal/core/modules/layout/tests/layouts/static/one-col/one-col.html.twig Template for a one column layout.
node.html.twig drupal/core/modules/node/templates/node.html.twig Default theme implementation to display a node.
node.html.twig drupal/core/themes/bartik/templates/node.html.twig Bartik's theme implementation to display a node.
node-edit-form.html.twig drupal/core/modules/node/templates/node-edit-form.html.twig Two column template for the node add/edit form.
maintenance-page.html.twig drupal/core/modules/system/templates/maintenance-page.html.twig Default theme implementation to display a single Drupal page while offline.
maintenance-page.html.twig drupal/core/themes/seven/templates/maintenance-page.html.twig Seven's theme implementation to display a single Drupal page while offline.
maintenance-page.html.twig drupal/core/themes/bartik/templates/maintenance-page.html.twig Bartik's theme implementation to display a single Drupal page while offline.
html.html.twig drupal/core/modules/system/templates/html.html.twig Default theme implementation for the basic structure of a single Drupal page.
forums.html.twig drupal/core/modules/forum/templates/forums.html.twig Default theme implementation to display a forum.
forum-topic-list.html.twig drupal/core/modules/forum/templates/forum-topic-list.html.twig Default theme implementation to display a list of forum topics.
forum-submitted.html.twig drupal/core/modules/forum/templates/forum-submitted.html.twig Default theme implementation for a forum post submission string.
forum-list.html.twig drupal/core/modules/forum/templates/forum-list.html.twig Default theme implementation to display a list of forums and containers.
forum-icon.html.twig drupal/core/modules/forum/templates/forum-icon.html.twig Default theme implementation to display a status icon for a forum post.
field.html.twig drupal/core/modules/field/templates/field.html.twig Default theme implementation for a field.
custom-block-add-list.html.twig drupal/core/modules/block/custom_block/templates/custom-block-add-list.html.twig Default theme implementation to present a list of custom block types.
comment.html.twig drupal/core/modules/comment/templates/comment.html.twig Default theme implementation for comments.
comment.html.twig drupal/core/themes/bartik/templates/comment.html.twig Bartik's theme implementation for comments.
comment-wrapper.html.twig drupal/core/modules/comment/templates/comment-wrapper.html.twig Default theme implementation for a comments container.
color-scheme-form.html.twig drupal/core/modules/color/templates/color-scheme-form.html.twig Default theme implementation for a theme's color form.
book-node-export-html.html.twig drupal/core/modules/book/templates/book-node-export-html.html.twig Default theme implementation for a single node in a printer-friendly outline.
book-navigation.html.twig drupal/core/modules/book/templates/book-navigation.html.twig Default theme implementation to navigate books.
book-export-html.html.twig drupal/core/modules/book/templates/book-export-html.html.twig Default theme implementation for printed version of book outline.
book-all-books-block.html.twig drupal/core/modules/book/templates/book-all-books-block.html.twig Default theme implementation for rendering book outlines within a block.
block.html.twig drupal/core/modules/block/templates/block.html.twig Default theme implementation to display a block.
aggregator-summary-items.html.twig drupal/core/modules/aggregator/templates/aggregator-summary-items.html.twig Default theme implementation to present feeds as list items.
aggregator-item.html.twig drupal/core/modules/aggregator/templates/aggregator-item.html.twig Default theme implementation to present a feed item in an aggregator page.
aggregator-feed-source.html.twig drupal/core/modules/aggregator/templates/aggregator-feed-source.html.twig Default theme implementation to present the source of the feed.