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

Namesort iconLocationDescription
phptemplate_menu_local_tasksdrupal/themes/garland/template.phpReturns the rendered local tasks. The default implementation renders them as tabs. Overridden to split the secondary tasks.
theme_address_paneubercart/uc_cart/uc_cart_checkout_pane.incTheme the delivery/billing address forms in tables.
theme_admin_blockdrupal/modules/system/system.admin.incThis function formats an administrative block for display.
theme_admin_block_contentdrupal/modules/system/system.admin.incThis function formats the content of an administrative block.
theme_admin_pagedrupal/modules/system/system.admin.incThis function formats an administrative page for viewing.
theme_aggregator_page_opmldrupal/modules/aggregator/aggregator.pages.incTheme the OPML feed output.
theme_aggregator_page_rssdrupal/modules/aggregator/aggregator.pages.incTheme the RSS output.
theme_blocksdrupal/includes/theme.incReturn a set of blocks available for the current user.
theme_book_admin_tabledrupal/modules/book/book.admin.incTheme function for the book administration page form. See alsobook_admin_table()
theme_book_title_linkdrupal/modules/book/book.moduleGenerate the HTML output for a link to a book title when used as a block title.
theme_boxdrupal/includes/theme.incReturn a themed box.
theme_breadcrumbdrupal/includes/theme.incReturn a themed breadcrumb trail.
theme_buttondrupal/includes/form.incTheme a form button.
theme_cart_review_tableubercart/uc_cart/uc_cart_checkout_pane.incFormat the cart contents table on the checkout page.
theme_checkboxdrupal/includes/form.incFormat a checkbox.
theme_checkboxesdrupal/includes/form.incFormat a set of checkboxes.
theme_closuredrupal/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/modules/color/color.moduleTheme color form.
theme_comment_admin_overviewdrupal/modules/comment/comment.admin.incTheme the comment admin form.
theme_comment_controlsdrupal/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/modules/comment/comment.moduleTheme comment flat collapsed view.
theme_comment_flat_expandeddrupal/modules/comment/comment.moduleTheme comment flat expanded view.
theme_comment_post_forbiddendrupal/modules/comment/comment.moduleTheme a "you can't post comments" notice.
theme_comment_submitteddrupal/modules/comment/comment.moduleTheme a "Submitted by ..." notice.
theme_comment_thread_collapseddrupal/modules/comment/comment.moduleTheme comment thread collapsed view.
theme_comment_thread_expandeddrupal/modules/comment/comment.moduleTheme comment thread expanded view.
theme_comment_viewdrupal/modules/comment/comment.moduleTheme a single comment block.
theme_datedrupal/includes/form.incFormat a date selection element.
theme_dblog_filtersdrupal/modules/dblog/dblog.moduleTheme dblog administration filter selector.
theme_feed_icondrupal/includes/theme.incReturn code that emits an feed icon.
theme_fieldsetdrupal/includes/form.incFormat a group of form items.
theme_filedrupal/includes/form.incFormat a file upload field.
theme_filter_admin_orderdrupal/modules/filter/filter.admin.incTheme filter order configuration form.
theme_filter_admin_overviewdrupal/modules/filter/filter.admin.incTheme the admin overview form.
theme_filter_tipsdrupal/modules/filter/filter.pages.incFormat a set of filter tips.
theme_filter_tips_more_infodrupal/modules/filter/filter.moduleFormat a link to the more extensive filter tips.
theme_formdrupal/includes/form.incFormat a form.
theme_form_elementdrupal/includes/form.incReturn a themed form element.
theme_helpdrupal/includes/theme.incReturn a themed help message.
theme_hiddendrupal/includes/form.incFormat a hidden form field.
theme_imagedrupal/includes/theme.incReturn a themed image.
theme_image_buttondrupal/includes/form.incTheme a form image button.
theme_indentationdrupal/includes/theme.incCreate a standard indentation div. Used for drag and drop tables.
theme_itemdrupal/includes/form.incFormat a form item.
theme_item_listdrupal/includes/theme.incReturn a themed list of items.
theme_linksdrupal/includes/theme.incReturn a themed set of links.
theme_locale_languages_overview_formdrupal/includes/locale.incTheme the language overview form.
theme_markdrupal/includes/theme.incReturn a themed marker, useful for marking new or updated content.
theme_menu_itemdrupal/includes/menu.incGenerate the HTML output for a menu item and submenu.
theme_menu_item_linkdrupal/includes/menu.incGenerate the HTML output for a single menu link.
theme_menu_local_taskdrupal/includes/menu.incGenerate the HTML output for a single local task link.
theme_menu_local_tasksdrupal/includes/menu.incReturns the rendered local tasks. The default implementation renders them as tabs.
theme_menu_overview_formdrupal/modules/menu/menu.admin.incTheme the menu overview form into a table.
theme_menu_treedrupal/includes/menu.incGenerate the HTML output for a menu tree
theme_more_help_linkdrupal/includes/theme.incReturns code that emits the 'more help'-link.
theme_more_linkdrupal/includes/theme.incReturns code that emits the 'more' link used on blocks.
theme_node_add_listdrupal/modules/node/node.pages.incDisplay the list of available node types for node creation.
theme_node_admin_nodesdrupal/modules/node/node.admin.incTheme node administration overview.
theme_node_filtersdrupal/modules/node/node.admin.incTheme node administration filter selector.
theme_node_filter_formdrupal/modules/node/node.admin.incTheme node administration filter form.
theme_node_formdrupal/modules/node/node.pages.incPresent a node submission form.
theme_node_listdrupal/modules/node/node.moduleFormat a listing of links to nodes.
theme_node_log_messagedrupal/modules/node/node.moduleTheme a log message.
theme_node_previewdrupal/modules/node/node.pages.incDisplay a node preview for display during node creation and editing.
theme_node_search_admindrupal/modules/node/node.moduleTheme the content ranking part of the search settings admin page.
theme_node_submitteddrupal/modules/node/node.moduleFormat the "Submitted by username on date/time" for each node
theme_pagerdrupal/includes/pager.incFormat a query pager.
theme_pager_firstdrupal/includes/pager.incFormat a "first page" link.
theme_pager_lastdrupal/includes/pager.incFormat a "last page" link.
theme_pager_linkdrupal/includes/pager.incFormat a link to a specific query result page.
theme_pager_nextdrupal/includes/pager.incFormat a "next page" link.
theme_pager_previousdrupal/includes/pager.incFormat a "previous page" link.
theme_passworddrupal/includes/form.incFormat a password field.
theme_password_confirmdrupal/includes/form.incFormat a password_confirm item.
theme_placeholderdrupal/includes/theme.incFormats text for emphasized display in a placeholder inside a sentence. Used automatically by t().
theme_poll_choicesdrupal/modules/poll/poll.moduleTheme the admin poll form for choices.
theme_profile_admin_overviewdrupal/modules/profile/profile.admin.incTheme the profile field overview into a drag and drop enabled table. See alsoprofile_admin_overview()
theme_progress_bardrupal/includes/theme.incReturn a themed progress bar.
theme_radiodrupal/includes/form.incFormat a radio button.
theme_radiosdrupal/includes/form.incFormat a set of radio buttons.
theme_selectdrupal/includes/form.incFormat a dropdown menu or scrolling selection box.
theme_status_messagesdrupal/includes/theme.incReturn a themed set of status and/or error messages. The messages are grouped by type.
theme_status_reportdrupal/modules/system/system.admin.incTheme requirements status report.
theme_submenudrupal/includes/theme.incReturn a themed submenu, typically displayed under the tabs.
theme_submitdrupal/includes/form.incTheme a form submit button.
theme_syslog_formatdrupal/modules/syslog/syslog.moduleFormat a system log entry.
theme_system_admin_by_moduledrupal/modules/system/system.admin.incTheme output of the dashboard page.
theme_system_modulesdrupal/modules/system/system.admin.incTheme callback for the modules form.
theme_system_modules_uninstalldrupal/modules/system/system.admin.incThemes a table of currently disabled modules.
theme_system_powered_bydrupal/modules/system/system.moduleFormat the Powered by Drupal text.
theme_system_themes_formdrupal/modules/system/system.admin.incTheme function for the system themes form.
theme_system_theme_select_formdrupal/modules/system/system.admin.incTheme the theme select form.
theme_tabledrupal/includes/theme.incReturn a themed table.
theme_tablesort_indicatordrupal/includes/theme.incReturn a themed sort icon.
theme_table_select_header_celldrupal/includes/theme.incReturns a header cell for tables that have a select all functionality.
theme_task_listdrupal/includes/theme.maintenance.incReturn a themed list of maintenance tasks to perform.
theme_taxonomy_overview_termsdrupal/modules/taxonomy/taxonomy.admin.incTheme the terms overview as a sortable list of terms. See alsotaxonomy_overview_terms()
theme_taxonomy_overview_vocabulariesdrupal/modules/taxonomy/taxonomy.admin.incTheme the vocabulary overview as a sortable list of vocabularies. See alsotaxonomy_overview_vocabularies()
theme_taxonomy_term_pagedrupal/modules/taxonomy/taxonomy.pages.incRender a taxonomy term page HTML output.
theme_taxonomy_term_selectdrupal/modules/taxonomy/taxonomy.moduleFormat the selection field for choosing terms (by deafult the default selection field is used).
theme_textareadrupal/includes/form.incFormat a textarea.
theme_textfielddrupal/includes/form.incFormat a textfield.
theme_tokendrupal/includes/form.incFormat a form token.
theme_trigger_displaydrupal/modules/trigger/trigger.admin.incDisplay actions assigned to this hook-op combination in a table.
theme_uc_admin_dashboardubercart/uc_store/uc_store.moduleTheme the dashboard on the admin/store page.
theme_uc_attribute_add_to_cartubercart/uc_attribute/uc_attribute.moduleDisplay the attribute selection form elements. See also_uc_attribute_alter_form()
theme_uc_attribute_options_formubercart/uc_attribute/uc_attribute.admin.incFormat an attribute and its options.
theme_uc_cart_block_contentubercart/uc_cart/uc_cart.moduleTheme the shopping cart block content.
theme_uc_cart_block_content_cachableubercart/uc_cart/uc_cart.moduleTheme the cachable shopping cart block content.
theme_uc_cart_block_itemsubercart/uc_cart/uc_cart.moduleTheme the table listing the items in the shopping cart block.
theme_uc_cart_block_summaryubercart/uc_cart/uc_cart.moduleTheme the summary table at the bottom of the default shopping cart block.
theme_uc_cart_block_titleubercart/uc_cart/uc_cart.moduleTheme the shopping cart block title
theme_uc_cart_block_title_iconubercart/uc_cart/uc_cart.moduleTheme the shopping cart icon.
theme_uc_cart_checkout_formubercart/uc_cart/uc_cart.pages.incAdd markup and styling to the checkout panes. See alsouc_cart_checkout_form()
theme_uc_cart_complete_saleubercart/uc_cart/uc_cart.moduleTheme the sale completion page.
theme_uc_cart_pane_quotesubercart/shipping/uc_quote/uc_quote.moduleDisplay the formatted quote cart pane.
theme_uc_cart_view_formubercart/uc_cart/uc_cart.module@see uc_cart_view_form()
theme_uc_cart_view_priceubercart/uc_cart/uc_cart.moduleDumb wrapper function, as the price has been themed by uc_price() already. See alsouc_cart_view_form()
theme_uc_catalog_blockubercart/uc_catalog/uc_catalog.moduleTheme the catalog block. See alsotheme_uc_catalog_item()
theme_uc_catalog_itemubercart/uc_catalog/uc_catalog.moduleDisplay a formatted link in the catalog block.
theme_uc_catalog_productsubercart/uc_catalog/uc_catalog.moduleDisplay a formatted list of products.
theme_uc_catalog_product_gridubercart/uc_catalog/uc_catalog.moduleDisplay a list of products in grid format().
theme_uc_empty_cartubercart/uc_cart/uc_cart.moduleReturn the text displayed for an empty shopping cart.
theme_uc_file_admin_files_form_showubercart/uc_file/uc_file.admin.inc@see uc_file_admin_files_form_show_files()
theme_uc_file_downloads_tokenubercart/uc_file/uc_file.moduleTheme file download links token.
theme_uc_file_hook_user_fileubercart/uc_file/uc_file.moduleTheme the file dialog at the user account page.
theme_uc_file_hook_user_file_downloadsubercart/uc_file/uc_file.moduleTheme the download table at the user account page.
theme_uc_object_attributes_formubercart/uc_attribute/uc_attribute.admin.incDisplay the formatted attribute form. See alsouc_object_attributes_form()
theme_uc_object_options_formubercart/uc_attribute/uc_attribute.admin.incDisplay the option form. See alsouc_object_options_form()
theme_uc_order_edit_formubercart/uc_order/uc_order.admin.inc@see uc_order_edit_form()
theme_uc_order_edit_products_formubercart/uc_order/uc_order.admin.inc@see uc_order_edit_products_form()
theme_uc_order_remove_productubercart/uc_order/uc_order.admin.incFormat the button to remove products from an order. See alsoop_products_edit_table()
theme_uc_order_state_tableubercart/uc_order/uc_order.moduleTheme the order state table in the order workflow settings.
theme_uc_order_view_update_controlsubercart/uc_order/uc_order.order_pane.inc@see uc_order_view_update_form()
theme_uc_pane_sort_tableubercart/uc_store/uc_store.moduleTheme a pane sorting form into a table.
theme_uc_priceubercart/uc_store/uc_store.moduleTheme a formatted price for display.
theme_uc_price_settings_formubercart/uc_store/uc_store.admin.incRender the price handler form, adding tabledrag. See alsouc_price_settings_form()
theme_uc_product_add_to_cartubercart/uc_product/uc_product.moduleWrap the "Add to Cart" form in a <div>.
theme_uc_product_bodyubercart/uc_product/uc_product.moduleFormat a product's body.
theme_uc_product_dimensionsubercart/uc_product/uc_product.moduleFormat a product's length, width, and height.
theme_uc_product_dimensions_formubercart/uc_product/uc_product.modulePut length, width, and height fields on the same line.
theme_uc_product_feature_add_formubercart/uc_product/uc_product.admin.inc@see uc_product_feature_add_form()
theme_uc_product_field_settings_formubercart/uc_product/uc_product.admin.incDisplay the product field settings form. See alsouc_product_field_settings_form()
theme_uc_product_form_pricesubercart/uc_product/uc_product.module
theme_uc_product_form_weightubercart/uc_product/uc_product.module
theme_uc_product_imageubercart/uc_product/uc_product.moduleFormat a product's images with imagecache and Thickbox.
theme_uc_product_kit_add_to_cartubercart/uc_product_kit/uc_product_kit.moduleWrap the "Add to Cart" form in a <div>.
theme_uc_product_modelubercart/uc_product/uc_product.moduleFormat a product's model number.
theme_uc_product_priceubercart/uc_product/uc_product.moduleFormat a product's price.
theme_uc_product_weightubercart/uc_product/uc_product.moduleFormat a product's weight.
theme_uc_quote_method_settingsubercart/shipping/uc_quote/uc_quote.admin.incDisplay a formatted list of shipping quote methods and form elements. See alsouc_quote_method_settings()
theme_uc_reports_product_tableubercart/uc_reports/uc_reports.admin.incReturn a themed table for product reports.
theme_uc_roles_expirationubercart/uc_roles/uc_roles.admin.incTheme user role expiration page.
theme_uc_roles_user_expirationubercart/uc_roles/uc_roles.moduleTheme the role expiration table within the roles dialog on the account edit page.
theme_uc_shipping_addressubercart/shipping/uc_shipping/uc_shipping.moduleCompact the address into a table.
theme_uc_shipping_edit_package_fieldsetubercart/shipping/uc_shipping/uc_shipping.admin.incDisplay a formatted shipping type fieldset.
theme_uc_shipping_new_package_fieldsetubercart/shipping/uc_shipping/uc_shipping.admin.incFormat and display the products in a shipping type fieldset.
theme_uc_shipping_new_shipmentubercart/shipping/uc_shipping/uc_shipping.admin.incFormat and display the new shipment form.
theme_uc_shipping_package_dimensionsubercart/shipping/uc_shipping/uc_shipping.moduleDisplay length, width, and height fields on one line.
theme_uc_stock_edit_formubercart/uc_stock/uc_stock.admin.inc@see uc_stock_edit_form()
theme_uc_store_address_fields_formubercart/uc_store/uc_store.module@see uc_store_address_fields_form()
theme_uc_store_footerubercart/uc_store/uc_store.moduleWrap the footer in a div so it can be re-styled.
theme_uc_ups_confirm_shipmentubercart/shipping/uc_ups/uc_ups.admin.incDisplay final shipment information for review. See alsouc_ups_confirm_shipment()
theme_uc_ups_label_imageubercart/shipping/uc_ups/uc_ups.admin.incDisplay the shipping label for printing.
theme_uc_ups_option_labelubercart/shipping/uc_ups/uc_ups.admin.incTheme function to format the UPS service name and rate amount line-item shown to the customer.
theme_update_reportdrupal/modules/update/update.report.incTheme project status report.
theme_update_versiondrupal/modules/update/update.report.incTheme the version display of a project.
theme_upload_attachmentsdrupal/modules/upload/upload.moduleDisplays file attachments in table
theme_upload_form_currentdrupal/modules/upload/upload.moduleTheme the attachments list.
theme_upload_form_newdrupal/modules/upload/upload.moduleTheme the attachment form. Note: required to output prefix/suffix.
theme_usernamedrupal/includes/theme.incFormat a username.
theme_user_admin_accountdrupal/modules/user/user.admin.incTheme user administration overview.
theme_user_admin_new_roledrupal/modules/user/user.admin.incTheme the new-role form.
theme_user_admin_permdrupal/modules/user/user.admin.incTheme the administer permissions page.
theme_user_filtersdrupal/modules/user/user.admin.incTheme user administration filter selector.
theme_user_filter_formdrupal/modules/user/user.admin.incTheme user administration filter form.
theme_user_listdrupal/modules/user/user.moduleMake a list of users.
theme_user_profiledocs/docs/developer/theme.phpTheme a user page.
theme_user_signaturedrupal/modules/user/user.moduleTheme output of user signature.
theme_xml_icondrupal/includes/theme.incReturn code that emits an XML icon.