Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

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_tasks6/themes/garland/template.phpReturns the rendered local tasks. The default implementation renders them as tabs. Overridden to split the secondary tasks.
theme_admin_block6/modules/system/system.admin.incThis function formats an administrative block for display.
theme_admin_block_content6/modules/system/system.admin.incThis function formats the content of an administrative block.
theme_admin_menu_iconcontributions/admin_menu/admin_menu.moduleRender an icon to display in the Administration Menu.
theme_admin_menu_itemcontributions/admin_menu/admin_menu.moduleGenerate the HTML output for a single menu item and submenu.
theme_admin_page6/modules/system/system.admin.incThis function formats an administrative page for viewing.
theme_aggregator_page_opml6/modules/aggregator/aggregator.pages.incTheme the OPML feed output.
theme_aggregator_page_rss6/modules/aggregator/aggregator.pages.incTheme the RSS output.
theme_blocks6/includes/theme.incReturn a set of blocks available for the current user.
theme_book_admin_table6/modules/book/book.admin.incTheme function for the book administration page form. See alsobook_admin_table()
theme_book_title_link6/modules/book/book.moduleGenerate the HTML output for a link to a book title when used as a block title.
theme_box6/includes/theme.incReturn a themed box.
theme_breadcrumb6/includes/theme.incReturn a themed breadcrumb trail.
theme_button6/includes/form.incTheme a form button.
theme_checkbox6/includes/form.incFormat a checkbox.
theme_checkboxes6/includes/form.incFormat a set of checkboxes.
theme_closure6/includes/theme.incExecute hook_footer() which is run at the end of the page right before the close of the body tag.
theme_comment_admin_overview6/modules/comment/comment.admin.incTheme the comment admin form.
theme_comment_controls6/modules/comment/comment.moduleTheme comment controls box where the user can change the default display mode and display order of comments.
theme_comment_flat_collapsed6/modules/comment/comment.moduleTheme comment flat collapsed view.
theme_comment_flat_expanded6/modules/comment/comment.moduleTheme comment flat expanded view.
theme_comment_post_forbidden6/modules/comment/comment.moduleTheme a "you can't post comments" notice.
theme_comment_submitted6/modules/comment/comment.moduleTheme a "Submitted by ..." notice.
theme_comment_thread_collapsed6/modules/comment/comment.moduleTheme comment thread collapsed view.
theme_comment_thread_expanded6/modules/comment/comment.moduleTheme comment thread expanded view.
theme_comment_view6/modules/comment/comment.moduleTheme a single comment block.
theme_date6/includes/form.incFormat a date selection element.
theme_date_display_combinationcontributions/date/date/date.themeTheme from/to date combination in the view.
theme_date_format_intervalcontributions/date/date/date.themeTheme a format interval for a date element
theme_date_repeat_displaycontributions/date/date/date.themeTheme the human-readable description for a Date Repeat rule.
theme_date_views_browser_full_viewcontributions/date/date/date.themeView, themed so it can be overridden
theme_date_views_browser_itemscontributions/date/date/date.themeAlternative Date Browser Display
theme_date_views_browser_navigationcontributions/date/date/date.themeTheme for page navigation
theme_date_views_browser_period_labelcontributions/date/date/date.themeTheme for the current period label name
theme_date_views_browser_summary_viewcontributions/date/date/date.themeDisplay a summary version of a view.
theme_dblog_filters6/modules/dblog/dblog.moduleTheme dblog administration filter selector.
theme_feed_icon6/includes/theme.incReturn code that emits an feed icon.
theme_fieldset6/includes/form.incFormat a group of form items.
theme_file6/includes/form.incFormat a file upload field.
theme_filter_admin_order6/modules/filter/filter.admin.incTheme filter order configuration form.
theme_filter_admin_overview6/modules/filter/filter.admin.incTheme the admin overview form.
theme_filter_tips6/modules/filter/filter.pages.incFormat a set of filter tips.
theme_filter_tips_more_info6/modules/filter/filter.moduleFormat a link to the more extensive filter tips.
theme_form6/includes/form.incFormat a form.
theme_form_element6/includes/form.incReturn a themed form element.
theme_forward_emailcontributions/forward/forward.themeFormat the links for event calendars
theme_forward_postcardcontributions/forward/forward.themeFormat the links for event calendars
theme_help6/includes/theme.incReturn a themed help message.
theme_hidden6/includes/form.incFormat a hidden form field.
theme_image6/includes/theme.incReturn a themed image.
theme_image_button6/includes/form.incTheme a form image button.
theme_indentation6/includes/theme.incCreate a standard indentation div. Used for drag and drop tables.
theme_item6/includes/form.incFormat a form item.
theme_item_list6/includes/theme.incReturn a themed list of items.
theme_links6/includes/theme.incReturn a themed set of links.
theme_locale_languages_overview_form6/includes/locale.incTheme the language overview form.
theme_mark6/includes/theme.incReturn a themed marker, useful for marking new or updated content.
theme_menu_item6/includes/menu.incGenerate the HTML output for a menu item and submenu.
theme_menu_item_link6/includes/menu.incGenerate the HTML output for a single menu link.
theme_menu_local_task6/includes/menu.incGenerate the HTML output for a single local task link.
theme_menu_local_tasks6/includes/menu.incReturns the rendered local tasks. The default implementation renders them as tabs.
theme_menu_overview_form6/modules/menu/menu.admin.incTheme the menu overview form into a table.
theme_menu_tree6/includes/menu.incGenerate the HTML output for a menu tree
theme_more_help_link6/includes/theme.incReturns code that emits the 'more help'-link.
theme_more_link6/includes/theme.incReturns code that emits the 'more' link used on blocks.
theme_node_add_list6/modules/node/node.pages.incDisplay the list of available node types for node creation.
theme_node_admin_nodes6/modules/node/node.admin.incTheme node administration overview.
theme_node_filters6/modules/node/node.admin.incTheme node administration filter selector.
theme_node_filter_form6/modules/node/node.admin.incTheme node administration filter form.
theme_node_form6/modules/node/node.pages.incPresent a node submission form.
theme_node_list6/modules/node/node.moduleFormat a listing of links to nodes.
theme_node_log_message6/modules/node/node.moduleTheme a log message.
theme_node_preview6/modules/node/node.pages.incDisplay a node preview for display during node creation and editing.
theme_node_search_admin6/modules/node/node.moduleTheme the content ranking part of the search settings admin page.
theme_node_submitted6/modules/node/node.moduleFormat the "Submitted by username on date/time" for each node
theme_og_panels_tablecontributions/og/og_panels.moduleWrangle the $form into a tabular listing of pages.
theme_pager6/includes/pager.incFormat a query pager.
theme_pager_first6/includes/pager.incFormat a "first page" link.
theme_pager_last6/includes/pager.incFormat a "last page" link.
theme_pager_link6/includes/pager.incFormat a link to a specific query result page.
theme_pager_next6/includes/pager.incFormat a "next page" link.
theme_pager_previous6/includes/pager.incFormat a "previous page" link.
theme_password6/includes/form.incFormat a password field.
theme_password_confirm6/includes/form.incFormat a password_confirm item.
theme_placeholder6/includes/theme.incFormats text for emphasized display in a placeholder inside a sentence. Used automatically by t().
theme_poll_choices6/modules/poll/poll.moduleTheme the admin poll form for choices.
theme_profile_admin_overview6/modules/profile/profile.admin.incTheme the profile field overview into a drag and drop enabled table. See alsoprofile_admin_overview()
theme_progress_bar6/includes/theme.incReturn a themed progress bar.
theme_radio6/includes/form.incFormat a radio button.
theme_radios6/includes/form.incFormat a set of radio buttons.
theme_select6/includes/form.incFormat a dropdown menu or scrolling selection box.
theme_status_messages6/includes/theme.incReturn a themed set of status and/or error messages. The messages are grouped by type.
theme_status_report6/modules/system/system.admin.incTheme requirements status report.
theme_submenu6/includes/theme.incReturn a themed submenu, typically displayed under the tabs.
theme_submit6/includes/form.incTheme a form submit button.
theme_syslog_format6/modules/syslog/syslog.moduleFormat a system log entry.
theme_system_admin_by_module6/modules/system/system.admin.incTheme output of the dashboard page.
theme_system_modules6/modules/system/system.admin.incTheme callback for the modules form.
theme_system_modules_uninstall6/modules/system/system.admin.incThemes a table of currently disabled modules.
theme_system_powered_by6/modules/system/system.moduleFormat the Powered by Drupal text.
theme_system_themes_form6/modules/system/system.admin.incTheme function for the system themes form.
theme_system_theme_select_form6/modules/system/system.admin.incTheme the theme select form.
theme_table6/includes/theme.incReturn a themed table.
theme_tablesort_indicator6/includes/theme.incReturn a themed sort icon.
theme_table_select_header_cell6/includes/theme.incReturns a header cell for tables that have a select all functionality.
theme_task_list6/includes/theme.maintenance.incReturn a themed list of maintenance tasks to perform.
theme_taxonomy_overview_terms6/modules/taxonomy/taxonomy.admin.incTheme the terms overview as a sortable list of terms. See alsotaxonomy_overview_terms()
theme_taxonomy_overview_vocabularies6/modules/taxonomy/taxonomy.admin.incTheme the vocabulary overview as a sortable list of vocabularies. See alsotaxonomy_overview_vocabularies()
theme_taxonomy_term_page6/modules/taxonomy/taxonomy.pages.incRender a taxonomy term page HTML output.
theme_taxonomy_term_select6/modules/taxonomy/taxonomy.moduleFormat the selection field for choosing terms (by deafult the default selection field is used).
theme_textarea6/includes/form.incFormat a textarea.
theme_textfield6/includes/form.incFormat a textfield.
theme_token6/includes/form.incFormat a form token.
theme_trigger_display6/modules/trigger/trigger.admin.incDisplay actions assigned to this hook-op combination in a table.
theme_uc_attributecontributions/ubercart/uc_attribute/uc_attribute.moduleDisplay formatted of data associated with attributes
theme_uc_attribute_optionscontributions/ubercart/uc_attribute/uc_attribute.moduleFormat an attribute and its options.
theme_uc_catalog_block_endcontributions/ubercart/uc_catalog/uc_catalog.moduleTheme the end of the catalog block. See alsotheme_uc_catalog_block_start
theme_uc_catalog_block_startcontributions/ubercart/uc_catalog/uc_catalog.moduleTheme the beginning of the catalog block. See alsotheme_uc_catalog_item
theme_uc_catalog_itemcontributions/ubercart/uc_catalog/uc_catalog.moduleDisplay a formatted link in the catalog block. See alsotheme_uc_catalog_block_start
theme_uc_object_attributes_formcontributions/ubercart/uc_attribute/uc_attribute.moduleDisplay the formatted attribute form.
theme_uc_object_options_formcontributions/ubercart/uc_attribute/uc_attribute.moduleDisplay the option form.
theme_uc_product_add_to_cartcontributions/ubercart/uc_product/uc_product.moduleWrap the "Add to Cart" form in a <div>.
theme_uc_product_dimensionscontributions/ubercart/uc_product/uc_product.moduleFormat a product's length, width, and height.
theme_uc_product_dimensions_formcontributions/ubercart/uc_product/uc_product.modulePut length, width, and height fields on the same line.
theme_uc_product_display_pricecontributions/ubercart/uc_product/uc_product.module
theme_uc_product_feature_add_formcontributions/ubercart/uc_product/uc_product.module
theme_uc_product_field_settings_formcontributions/ubercart/uc_product/uc_product.moduleDisplay the product field settings form. See alsouc_product_field_settings_form
theme_uc_product_form_pricescontributions/ubercart/uc_product/uc_product.module
theme_uc_product_form_weightcontributions/ubercart/uc_product/uc_product.module
theme_uc_product_imagecontributions/ubercart/uc_product/uc_product.moduleFormat a product's images with imagecache and Thickbox.
theme_uc_product_kit_add_to_cartcontributions/ubercart/uc_product_kit/uc_product_kit.moduleWrap the "Add to Cart" form in a <div>.
theme_uc_product_modelcontributions/ubercart/uc_product/uc_product.moduleFormat a product's model number.
theme_uc_product_pricecontributions/ubercart/uc_product/uc_product.moduleFormat a product's price.
theme_uc_product_sell_pricecontributions/ubercart/uc_product/uc_product.moduleFormat the selling price based on the view mode.
theme_uc_product_weightcontributions/ubercart/uc_product/uc_product.moduleFormat a product's weight.
theme_uc_quote_method_settingscontributions/ubercart/shipping/uc_quote/uc_quote.moduleDisplay a formatted list of shipping quote methods and form elements. See alsouc_quote_method_settings
theme_uc_shipping_addresscontributions/ubercart/shipping/uc_shipping/uc_shipping.moduleCompact the address into a table.
theme_uc_shipping_edit_package_fieldsetcontributions/ubercart/shipping/uc_shipping/uc_shipping.moduleDisplay a formatted shipping type fieldset.
theme_uc_shipping_new_package_fieldsetcontributions/ubercart/shipping/uc_shipping/uc_shipping.moduleFormat and display the products in a shipping type fieldset.
theme_uc_shipping_new_shipmentcontributions/ubercart/shipping/uc_shipping/uc_shipping.moduleFormat and display the new shipment form.
theme_uc_shipping_package_dimensionscontributions/ubercart/shipping/uc_shipping/uc_shipping.moduleDisplay length, width, and height fields on one line.
theme_uc_ups_label_imagecontributions/ubercart/shipping/uc_ups/uc_ups.moduleDisplay the shipping label for printing.
theme_update_report6/modules/update/update.report.incTheme project status report.
theme_update_version6/modules/update/update.report.incTheme the version display of a project.
theme_upload_attachments6/modules/upload/upload.moduleDisplays file attachments in table
theme_upload_form_current6/modules/upload/upload.moduleTheme the attachments list.
theme_upload_form_new6/modules/upload/upload.moduleTheme the attachment form. Note: required to output prefix/suffix.
theme_username6/includes/theme.incFormat a username.
theme_user_admin_account6/modules/user/user.admin.incTheme user administration overview.
theme_user_admin_new_role6/modules/user/user.admin.incTheme the new-role form.
theme_user_admin_perm6/modules/user/user.admin.incTheme the administer permissions page.
theme_user_filters6/modules/user/user.admin.incTheme user administration filter selector.
theme_user_filter_form6/modules/user/user.admin.incTheme user administration filter form.
theme_user_list6/modules/user/user.moduleMake a list of users.
theme_user_signature6/modules/user/user.moduleTheme output of user signature.
theme_xml_icon6/includes/theme.incReturn code that emits an XML icon.