Drupal7 API Default theme implementations

来源:互联网 发布:经典马自达3轮毂数据 编辑:程序博客网 时间:2024/06/02 04:13

Default theme implementations

  1. 8.x drupal/core/lib/Drupal/Core/Render/theme.api.php themeable
  2. 6.x drupal/includes/theme.inc themeable
  3. 7.x drupal/modules/system/theme.api.php themeable

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 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 THEMENAME_HOOK. For example, for Drupal's default theme (Bartik) to implement the 'table' hook, the phptemplate.enginewould find bartik_table().

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

End of "defgroup themeable".

另请参阅

theme()

hook_theme()

Hooks

Callbacks

文件

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

函数

名字降序排列位置描述theme_admin_blockdrupal/modules/system/system.admin.incReturns HTML for an administrative block for display.theme_admin_block_contentdrupal/modules/system/system.admin.incReturns HTML for the content of an administrative block.theme_admin_pagedrupal/modules/system/system.admin.incReturns HTML for an administrative page.theme_aggregator_block_itemdrupal/modules/aggregator/aggregator.moduleReturns HTML for an individual feed item for display in the block.theme_aggregator_categorize_itemsdrupal/modules/aggregator/aggregator.pages.incReturns HTML for the aggregator page list form for assigning categories.theme_aggregator_page_opmldrupal/modules/aggregator/aggregator.pages.incPrints the OPML page for the feed.theme_aggregator_page_rssdrupal/modules/aggregator/aggregator.pages.incPrints the RSS page for a feed.theme_authorize_messagedrupal/includes/theme.maintenance.incReturns HTML for a single log message from the authorize.phpbatch operation.theme_authorize_reportdrupal/includes/theme.maintenance.incReturns HTML for a results report of an operation run by authorize.php.theme_book_admin_tabledrupal/modules/book/book.admin.incReturns HTML for a book administration form.theme_book_title_linkdrupal/modules/book/book.moduleReturns HTML for a link to a book title when used as a block title.theme_breadcrumbdrupal/includes/theme.incReturns HTML for a breadcrumb trail.theme_buttondrupal/includes/form.incReturns HTML for a button form element.theme_checkboxdrupal/includes/form.incReturns HTML for a checkbox form element.theme_checkboxesdrupal/includes/form.incReturns HTML for a set of checkbox form elements.theme_color_scheme_formdrupal/modules/color/color.moduleReturns HTML for a theme's color form.theme_comment_blockdrupal/modules/comment/comment.moduleReturns HTML for a list of recent comments to be displayed in the comment block.theme_comment_post_forbiddendrupal/modules/comment/comment.moduleReturns HTML for a "you can't post comments" notice.theme_confirm_formdrupal/modules/system/system.moduleReturns HTML for a confirmation form.theme_containerdrupal/includes/form.incReturns HTML to wrap child elements in a container.theme_dashboarddrupal/modules/dashboard/dashboard.moduleReturns HTML for the entire dashboard.theme_dashboard_admindrupal/modules/dashboard/dashboard.moduleReturns HTML for the non-customizable part of the dashboard page.theme_dashboard_disabled_blockdrupal/modules/dashboard/dashboard.moduleReturns HTML for disabled blocks, for use in dashboard customization mode.theme_dashboard_disabled_blocksdrupal/modules/dashboard/dashboard.moduleReturns HTML for disabled blocks, for use in dashboard customization mode.theme_dashboard_regiondrupal/modules/dashboard/dashboard.moduleReturns HTML for a generic dashboard region.theme_datedrupal/includes/form.incReturns HTML for a date selection form element.theme_dblog_messagedrupal/modules/dblog/dblog.admin.incReturns HTML for a log message.theme_exposed_filtersdrupal/modules/system/system.moduleReturns HTML for an exposed filter form.theme_feed_icondrupal/includes/theme.incReturns HTML for a feed icon.theme_fielddrupal/modules/field/field.moduleReturns HTML for a field.theme_fieldsetdrupal/includes/form.incReturns HTML for a fieldset form element and its children.theme_field_multiple_value_formdrupal/modules/field/field.form.incReturns HTML for an individual form element.theme_field_ui_tabledrupal/modules/field_ui/field_ui.admin.incReturns HTML for Field UI overview tables.theme_filedrupal/includes/form.incReturns HTML for a file upload form element.theme_file_formatter_tabledrupal/modules/file/file.field.incReturns HTML for a file attachments table.theme_file_icondrupal/modules/file/file.moduleReturns HTML for an image with an appropriate icon for the given file.theme_file_linkdrupal/modules/file/file.moduleReturns HTML for a link to a file.theme_file_managed_filedrupal/modules/file/file.moduleReturns HTML for a managed file element.theme_file_upload_helpdrupal/modules/file/file.field.incReturns HTML for help text based on file upload validators.theme_file_widgetdrupal/modules/file/file.field.incReturns HTML for an individual file upload widget.theme_file_widget_multipledrupal/modules/file/file.field.incReturns HTML for a group of file upload widgets.theme_filter_admin_format_filter_orderdrupal/modules/filter/filter.admin.incReturns HTML for a text format's filter order form.theme_filter_admin_overviewdrupal/modules/filter/filter.admin.incReturns HTML for the text format administration overview form.theme_filter_guidelinesdrupal/modules/filter/filter.moduleReturns HTML for guidelines for a text format.theme_filter_tipsdrupal/modules/filter/filter.pages.incReturns HTML for a set of filter tips.theme_filter_tips_more_infodrupal/modules/filter/filter.moduleReturns HTML for a link to the more extensive filter tips.theme_formdrupal/includes/form.incReturns HTML for a form.theme_form_elementdrupal/includes/form.incReturns HTML for a form element.theme_form_element_labeldrupal/includes/form.incReturns HTML for a form element label and required marker.theme_form_required_markerdrupal/includes/form.incReturns HTML for a marker for required form elements.theme_forum_formdrupal/modules/forum/forum.admin.incReturns HTML for a forum form.theme_hiddendrupal/includes/form.incReturns HTML for a hidden form element.theme_html_tagdrupal/includes/theme.incReturns HTML for a generic HTML tag with attributes.theme_imagedrupal/includes/theme.incReturns HTML for an image.theme_image_anchordrupal/modules/image/image.admin.incReturns HTML for a 3x3 grid of checkboxes for image anchors.theme_image_buttondrupal/includes/form.incReturns HTML for an image button form element.theme_image_crop_summarydrupal/modules/image/image.admin.incReturns HTML for a summary of an image crop effect.theme_image_formatterdrupal/modules/image/image.field.incReturns HTML for an image field formatter.theme_image_resize_summarydrupal/modules/image/image.admin.incReturns HTML for a summary of an image resize effect.theme_image_rotate_summarydrupal/modules/image/image.admin.incReturns HTML for a summary of an image rotate effect.theme_image_scale_summarydrupal/modules/image/image.admin.incReturns HTML for a summary of an image scale effect.theme_image_styledrupal/modules/image/image.moduleReturns HTML for an image using a specific image style.theme_image_style_effectsdrupal/modules/image/image.admin.incReturns HTML for a listing of the effects within a specific image style.theme_image_style_listdrupal/modules/image/image.admin.incReturns HTML for the page containing the list of image styles.theme_image_style_previewdrupal/modules/image/image.admin.incReturns HTML for a preview of an image style.theme_image_widgetdrupal/modules/image/image.field.incReturns HTML for an image field widget.theme_indentationdrupal/includes/theme.incReturns HTML for an indentation div; used for drag and drop tables.theme_item_listdrupal/includes/theme.incReturns HTML for a list or nested list of items.theme_linkdrupal/includes/theme.incReturns HTML for a link.theme_linksdrupal/includes/theme.incReturns HTML for a set of links.theme_locale_date_format_formdrupal/modules/locale/locale.admin.incReturns HTML for a locale date format form.theme_locale_languages_configure_formdrupal/modules/locale/locale.admin.incReturns HTML for a language configuration form.theme_locale_languages_overview_formdrupal/modules/locale/locale.admin.incReturns HTML for the language overview form.theme_markdrupal/includes/theme.incReturns HTML for a marker for new or updated content.theme_menu_admin_overviewdrupal/modules/menu/menu.admin.incReturns HTML for a menu title and description for the menu overview page.theme_menu_linkdrupal/includes/menu.incReturns HTML for a menu link and submenu.theme_menu_local_actiondrupal/includes/menu.incReturns HTML for a single local action link.theme_menu_local_taskdrupal/includes/menu.incReturns HTML for a single local task link.theme_menu_local_tasksdrupal/includes/menu.incReturns HTML for primary and secondary local tasks.theme_menu_overview_formdrupal/modules/menu/menu.admin.incReturns HTML for the menu overview form into a table.theme_menu_treedrupal/includes/menu.incReturns HTML for a wrapper for a menu sub-tree.theme_more_help_linkdrupal/includes/theme.incReturns HTML for a "more help" link.theme_more_linkdrupal/includes/theme.incReturns HTML for a "more" link, like those used in blocks.theme_node_add_listdrupal/modules/node/node.pages.incReturns HTML for a list of available node types for node creation.theme_node_admin_overviewdrupal/modules/node/content_types.incReturns HTML for a node type description for the content type admin overview page.theme_node_previewdrupal/modules/node/node.pages.incReturns HTML for a node preview for display during node creation and editing.theme_node_recent_blockdrupal/modules/node/node.moduleReturns HTML for a list of recent content.theme_node_recent_contentdrupal/modules/node/node.moduleReturns HTML for a recent node to be displayed in the recent content block.theme_node_search_admindrupal/modules/node/node.moduleReturns HTML for the content ranking part of the search settings admin page.theme_options_nonedrupal/modules/field/modules/options/options.moduleReturns HTML for the label for the empty value for options that are not required.theme_overlay_disable_messagedrupal/modules/overlay/overlay.moduleReturns the HTML for the message about how to disable the overlay.theme_pagerdrupal/includes/pager.incReturns HTML for a query pager.theme_pager_firstdrupal/includes/pager.incReturns HTML for the "first page" link in a query pager.theme_pager_lastdrupal/includes/pager.incReturns HTML for the "last page" link in query pager.theme_pager_linkdrupal/includes/pager.incReturns HTML for a link to a specific query result page.theme_pager_nextdrupal/includes/pager.incReturns HTML for the "next page" link in a query pager.theme_pager_previousdrupal/includes/pager.incReturns HTML for the "previous page" link in a query pager.theme_passworddrupal/includes/form.incReturns HTML for a password form element.theme_poll_choicesdrupal/modules/poll/poll.moduleReturns HTML for an admin poll form for choices.theme_profile_admin_overviewdrupal/modules/profile/profile.admin.incReturns HTML for the profile field overview form into a drag and drop enabled table.theme_progress_bardrupal/includes/theme.incReturns HTML for a progress bar.theme_radiodrupal/includes/form.incReturns HTML for a radio button form element.theme_radiosdrupal/includes/form.incReturns HTML for a set of radio button form elements.theme_rdf_metadatadrupal/modules/rdf/rdf.moduleReturns HTML for a series of empty spans for exporting RDF metadata in RDFa.theme_rdf_template_variable_wrapperdrupal/modules/rdf/rdf.moduleReturns HTML for a template variable wrapped in an HTML element with the RDF attributes.theme_selectdrupal/includes/form.incReturns HTML for a select form element.theme_shortcut_set_customizedrupal/modules/shortcut/shortcut.admin.incReturns HTML for a shortcut set customization form.theme_simpletest_result_summarydrupal/modules/simpletest/simpletest.pages.incReturns HTML for the summary status of a simpletest result.theme_simpletest_test_tabledrupal/modules/simpletest/simpletest.pages.incReturns HTML for a test list generated by simpletest_test_form() into a table.theme_status_messagesdrupal/includes/theme.incReturns HTML for status and/or error messages, grouped by type.theme_status_reportdrupal/modules/system/system.admin.incReturns HTML for the status report.theme_submitdrupal/includes/form.incReturns HTML for a submit button form element.theme_system_admin_indexdrupal/modules/system/system.admin.incReturns HTML for the output of the dashboard page.theme_system_compact_linkdrupal/modules/system/system.moduleReturns HTML for a link to show or hide inline help descriptions.theme_system_date_time_settingsdrupal/modules/system/system.admin.incReturns HTML for the date settings form.theme_system_modules_fieldsetdrupal/modules/system/system.admin.incReturns HTML for the modules form.theme_system_modules_incompatibledrupal/modules/system/system.admin.incReturns HTML for a message about incompatible modules.theme_system_modules_uninstalldrupal/modules/system/system.admin.incReturns HTML for a table of currently disabled modules.theme_system_powered_bydrupal/modules/system/system.moduleReturns HTML for the Powered by Drupal text.theme_system_settings_formdrupal/modules/system/system.moduleReturns HTML for a system settings form.theme_system_themes_pagedrupal/modules/system/system.admin.incReturns HTML for the Appearance page.theme_tabledrupal/includes/theme.incReturns HTML for a table.theme_tableselectdrupal/includes/form.incReturns HTML for a table with radio buttons or checkboxes.theme_tablesort_indicatordrupal/includes/theme.incReturns HTML for a sort icon.theme_task_listdrupal/includes/theme.maintenance.incReturns HTML for a list of maintenance tasks to perform.theme_taxonomy_overview_termsdrupal/modules/taxonomy/taxonomy.admin.incReturns HTML for a terms overview form as a sortable list of terms.theme_taxonomy_overview_vocabulariesdrupal/modules/taxonomy/taxonomy.admin.incReturns HTML for the vocabulary overview form as a sortable list of vocabularies.theme_textareadrupal/includes/form.incReturns HTML for a textarea form element.theme_textfielddrupal/includes/form.incReturns HTML for a textfield form element.theme_text_format_wrapperdrupal/modules/filter/filter.moduleReturns HTML for a text format-enabled form element.theme_trigger_displaydrupal/modules/trigger/trigger.admin.incReturns HTML for the form showing actions assigned to a trigger.theme_update_last_checkdrupal/modules/update/update.moduleReturns HTML for the last time we checked for update data.theme_update_manager_update_formdrupal/modules/update/update.manager.incReturns HTML for the first page in the process of updating projects.theme_update_reportdrupal/modules/update/update.report.incReturns HTML for the project status report.theme_update_status_labeldrupal/modules/update/update.report.incReturns HTML for a label to display for a project's update status.theme_update_versiondrupal/modules/update/update.report.incReturns HTML for the version display of a project.theme_usernamedrupal/includes/theme.incReturns HTML for a username, potentially linked to the user's page.theme_user_admin_permissionsdrupal/modules/user/user.admin.incReturns HTML for the administer permissions page.theme_user_admin_rolesdrupal/modules/user/user.admin.incReturns HTML for the role order and new role form.theme_user_listdrupal/modules/user/user.moduleReturns HTML for a list of users.theme_user_permission_descriptiondrupal/modules/user/user.admin.incReturns HTML for an individual permission description.theme_user_signaturedrupal/modules/user/user.moduleReturns HTML for a user signature.theme_vertical_tabsdrupal/includes/form.incReturns HTML for an element's children fieldsets as vertical tabs.

文件

名字降序排列位置描述aggregator-feed-source.tpl.phpdrupal/modules/aggregator/aggregator-feed-source.tpl.phpDefault theme implementation to present the source of the feed.aggregator-item.tpl.phpdrupal/modules/aggregator/aggregator-item.tpl.phpDefault theme implementation to format an individual feed item for display on the aggregator page.aggregator-summary-item.tpl.phpdrupal/modules/aggregator/aggregator-summary-item.tpl.phpDefault theme implementation to present a linked feed item for summaries.aggregator-summary-items.tpl.phpdrupal/modules/aggregator/aggregator-summary-items.tpl.phpDefault theme implementation to present feeds as list items.aggregator-wrapper.tpl.phpdrupal/modules/aggregator/aggregator-wrapper.tpl.phpDefault theme implementation to wrap aggregator content.block-admin-display-form.tpl.phpdrupal/modules/block/block-admin-display-form.tpl.phpDefault theme implementation to configure blocks.block.tpl.phpdrupal/modules/block/block.tpl.phpDefault theme implementation to display a block.book-all-books-block.tpl.phpdrupal/modules/book/book-all-books-block.tpl.phpDefault theme implementation for rendering book outlines within a block.book-export-html.tpl.phpdrupal/modules/book/book-export-html.tpl.phpDefault theme implementation for printed version of book outline.book-navigation.tpl.phpdrupal/modules/book/book-navigation.tpl.phpDefault theme implementation to navigate books.book-node-export-html.tpl.phpdrupal/modules/book/book-node-export-html.tpl.phpDefault theme implementation for a single node in a printer-friendly outline.comment-wrapper.tpl.phpdrupal/modules/comment/comment-wrapper.tpl.phpDefault theme implementation to provide an HTML container for comments.comment.tpl.phpdrupal/modules/comment/comment.tpl.phpDefault theme implementation for comments.field.tpl.phpdrupal/modules/field/theme/field.tpl.phpfield.tpl.php Default template implementation to display the value of a field.forum-icon.tpl.phpdrupal/modules/forum/forum-icon.tpl.phpDisplays an appropriate icon for a forum post.forum-list.tpl.phpdrupal/modules/forum/forum-list.tpl.phpDisplays a list of forums and containers.forum-submitted.tpl.phpdrupal/modules/forum/forum-submitted.tpl.phpFormats a forum post submission string.forum-topic-list.tpl.phpdrupal/modules/forum/forum-topic-list.tpl.phpDisplays a list of forum topics.forums.tpl.phpdrupal/modules/forum/forums.tpl.phpDisplays a forum.html.tpl.phpdrupal/modules/system/html.tpl.phpDefault theme implementation to display the basic html structure of a single Drupal page.maintenance-page.tpl.phpdrupal/modules/system/maintenance-page.tpl.phpDefault theme implementation to display a single Drupal page while offline.node.tpl.phpdrupal/modules/node/node.tpl.phpDefault theme implementation to display a node.overlay.tpl.phpdrupal/modules/overlay/overlay.tpl.phpDefault theme implementation to display a page in the overlay.page.tpl.phpdrupal/modules/system/page.tpl.phpDefault theme implementation to display a single Drupal page.poll-results.tpl.phpdrupal/modules/poll/poll-results.tpl.phpDefault theme implementation to display the poll results in a block.poll-vote.tpl.phpdrupal/modules/poll/poll-vote.tpl.phpDefault theme implementation to display voting form for a poll.region.tpl.phpdrupal/modules/system/region.tpl.phpDefault theme implementation to display a region.search-result.tpl.phpdrupal/modules/search/search-result.tpl.phpDefault theme implementation for displaying a single search result.search-results.tpl.phpdrupal/modules/search/search-results.tpl.phpDefault theme implementation for displaying search results.taxonomy-term.tpl.phpdrupal/modules/taxonomy/taxonomy-term.tpl.phpDefault theme implementation to display a term.toolbar.tpl.phpdrupal/modules/toolbar/toolbar.tpl.phpDefault template for admin toolbar.user-picture.tpl.phpdrupal/modules/user/user-picture.tpl.phpDefault theme implementation to present a picture configured for the user's account.user-profile.tpl.phpdrupal/modules/user/user-profile.tpl.phpDefault theme implementation to present all user profile data.
原创粉丝点击