page.html.twig

Seven's theme implementation to display a single Drupal page.

The doctype, html, head, and body tags are not in this template. Instead they can be found in the html.html.twig template normally located in the core/modules/system directory.

Available variables:

General utility variables:

  • base_path: The base URL path of the Drupal installation. Will usually be "/" unless you have installed Drupal in a sub-directory.
  • is_front: A flag indicating if the current page is the front page.
  • logged_in: A flag indicating if the user is registered and signed in.
  • is_admin: A flag indicating if the user has permission to access administration pages.

Site identity:

  • front_page: The URL of the front page. Use this instead of base_path when linking to the front page. This includes the language domain or prefix.
  • logo: The url of the logo image, as defined in theme settings.
  • site_name: The name of the site. This is empty when displaying the site name has been disabled in the theme settings.
  • site_slogan: The slogan of the site. This is empty when displaying the site slogan has been disabled in theme settings.

Navigation:

  • main_menu: The Main menu links for the site, if they have been configured.
  • secondary_menu: The Secondary menu links for the site, if they have been configured.
  • breadcrumb: The breadcrumb trail for the current page.

Page content (in order of occurrence in the default page.html.twig):

  • title_prefix: Additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
  • title: The page title, for use in the actual content.
  • title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
  • messages: Status and error messages. Should be displayed prominently.
  • tabs: Tabs linking to any sub-pages beneath the current page (e.g., the view and edit tabs when displaying a node).
  • action_links: Actions local to the page, such as "Add menu" on the menu administration interface.
  • feed_icons: All feed icons for the current page.
  • node: Fully loaded node, if there is an automatically-loaded node associated with the page and the node ID is the second argument in the page's path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).

Regions:

  • page.header: Items for the header region.
  • page.highlighted: Items for the highlighted content region.
  • page.help: Dynamic help text, mostly for admin pages.
  • page.content: The main content of the current page.
  • page.sidebar_first: Items for the first sidebar.
  • page.sidebar_second: Items for the second sidebar.
  • page.footer: Items for the footer region.

See also

template_preprocess()

template_preprocess_page()

seven_preprocess_page()

template_process()

template_process_page()

html.html.twig

1 theme call to page.html.twig
system_element_info in drupal/core/modules/system/system.module
Implements hook_element_info().

File

drupal/core/themes/seven/templates/page.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Seven's theme implementation to display a single Drupal page.
  5. *
  6. * The doctype, html, head, and body tags are not in this template. Instead
  7. * they can be found in the html.html.twig template normally located in the
  8. * core/modules/system directory.
  9. *
  10. * Available variables:
  11. *
  12. * General utility variables:
  13. * - base_path: The base URL path of the Drupal installation. Will usually be
  14. * "/" unless you have installed Drupal in a sub-directory.
  15. * - is_front: A flag indicating if the current page is the front page.
  16. * - logged_in: A flag indicating if the user is registered and signed in.
  17. * - is_admin: A flag indicating if the user has permission to access
  18. * administration pages.
  19. *
  20. * Site identity:
  21. * - front_page: The URL of the front page. Use this instead of base_path when
  22. * linking to the front page. This includes the language domain or prefix.
  23. * - logo: The url of the logo image, as defined in theme settings.
  24. * - site_name: The name of the site. This is empty when displaying the site
  25. * name has been disabled in the theme settings.
  26. * - site_slogan: The slogan of the site. This is empty when displaying the site
  27. * slogan has been disabled in theme settings.
  28. *
  29. * Navigation:
  30. * - main_menu: The Main menu links for the site, if they have been configured.
  31. * - secondary_menu: The Secondary menu links for the site, if they have been
  32. * configured.
  33. * - breadcrumb: The breadcrumb trail for the current page.
  34. *
  35. * Page content (in order of occurrence in the default page.html.twig):
  36. * - title_prefix: Additional output populated by modules, intended to be
  37. * displayed in front of the main title tag that appears in the template.
  38. * - title: The page title, for use in the actual content.
  39. * - title_suffix: Additional output populated by modules, intended to be
  40. * displayed after the main title tag that appears in the template.
  41. * - messages: Status and error messages. Should be displayed prominently.
  42. * - tabs: Tabs linking to any sub-pages beneath the current page (e.g., the
  43. * view and edit tabs when displaying a node).
  44. * - action_links: Actions local to the page, such as "Add menu" on the menu
  45. * administration interface.
  46. * - feed_icons: All feed icons for the current page.
  47. * - node: Fully loaded node, if there is an automatically-loaded node
  48. * associated with the page and the node ID is the second argument in the
  49. * page's path (e.g. node/12345 and node/12345/revisions, but not
  50. * comment/reply/12345).
  51. *
  52. * Regions:
  53. * - page.header: Items for the header region.
  54. * - page.highlighted: Items for the highlighted content region.
  55. * - page.help: Dynamic help text, mostly for admin pages.
  56. * - page.content: The main content of the current page.
  57. * - page.sidebar_first: Items for the first sidebar.
  58. * - page.sidebar_second: Items for the second sidebar.
  59. * - page.footer: Items for the footer region.
  60. *
  61. * @see template_preprocess()
  62. * @see template_preprocess_page()
  63. * @see seven_preprocess_page()
  64. * @see template_process()
  65. * @see template_process_page()
  66. * @see html.html.twig
  67. *
  68. * @ingroup themeable
  69. */
  70. #}
  71. <header id="branding" class="clearfix" role="navigation">
  72. {{ breadcrumb }}
  73. {{ title_prefix }}
  74. {% if title %}
  75. <h1 class="page-title">{{ title }}</h1>
  76. {% endif %}
  77. {{ title_suffix }}
  78. {% if primary_local_tasks %}
  79. {{ primary_local_tasks }}
  80. {% endif %}
  81. </header>
  82. <div id="page">
  83. {% if secondary_local_tasks %}
  84. <div class="tabs-secondary clearfix" role="navigation">{{ secondary_local_tasks }}</div>
  85. {% endif %}
  86. <main id="content" class="clearfix" role="main">
  87. <div class="element-invisible"><a id="main-content"></a></div>
  88. {% if messages %}
  89. <div id="console" class="clearfix">{{ messages }}</div>
  90. {% endif %}
  91. {% if page.help %}
  92. <div id="help">
  93. {{ page.help }}
  94. </div>
  95. {% endif %}
  96. {% if action_links %}
  97. <ul class="action-links">
  98. {{ action_links }}
  99. </ul>
  100. {% endif %}
  101. {{ page.content }}
  102. </main>
  103. <footer id="footer" role="contentinfo">
  104. {{ feed_icons }}
  105. </footer>
  106. </div>

Related topics