page.html.twig

Bartik's theme implementation to display a single 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.
  • hide_site_name: A flag indicating if the site name has been toggled off on the theme settings page. If hidden, the "element-invisible" class is added to make the site name visually hidden, but still accessible.
  • hide_site_slogan: A flag indicating if the site slogan has been toggled off on the theme settings page. If hidden, the "element-invisible" class is added to make the site slogan visually hidden, but still accessible.

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.featured: Items for the featured 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.triptych_first: Items for the first triptych.
  • page.triptych_middle: Items for the middle triptych.
  • page.triptych_last: Items for the last triptych.
  • page.footer_firstcolumn: Items for the first footer column.
  • page.footer_secondcolumn: Items for the second footer column.
  • page.footer_thirdcolumn: Items for the third footer column.
  • page.footer_fourthcolumn: Items for the fourth footer column.
  • page.footer: Items for the footer region.

See also

template_preprocess()

template_preprocess_page()

bartik_preprocess_page()

template_process()

template_process_page()

bartik_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/bartik/templates/page.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Bartik's theme implementation to display a single page.
  5. *
  6. * The doctype, html, head and body tags are not in this template. Instead they
  7. * 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. * - hide_site_name: A flag indicating if the site name has been toggled off on
  29. * the theme settings page. If hidden, the "element-invisible" class is added
  30. * to make the site name visually hidden, but still accessible.
  31. * - hide_site_slogan: A flag indicating if the site slogan has been toggled off
  32. * on the theme settings page. If hidden, the "element-invisible" class is
  33. * added to make the site slogan visually hidden, but still accessible.
  34. *
  35. * Navigation:
  36. * - main_menu: The Main menu links for the site, if they have been configured.
  37. * - secondary_menu: The Secondary menu links for the site, if they have been
  38. * configured.
  39. * - breadcrumb: The breadcrumb trail for the current page.
  40. *
  41. * Page content (in order of occurrence in the default page.html.twig):
  42. * - title_prefix: Additional output populated by modules, intended to be
  43. * displayed in front of the main title tag that appears in the template.
  44. * - title: The page title, for use in the actual content.
  45. * - title_suffix: Additional output populated by modules, intended to be
  46. * displayed after the main title tag that appears in the template.
  47. * - messages: Status and error messages. Should be displayed prominently.
  48. * - tabs: Tabs linking to any sub-pages beneath the current page (e.g., the
  49. * view and edit tabs when displaying a node).
  50. * - action_links: Actions local to the page, such as "Add menu" on the menu
  51. * administration interface.
  52. * - feed_icons: All feed icons for the current page.
  53. * - node: Fully loaded node, if there is an automatically-loaded node
  54. * associated with the page and the node ID is the second argument in the
  55. * page's path (e.g. node/12345 and node/12345/revisions, but not
  56. * comment/reply/12345).
  57. *
  58. * Regions:
  59. * - page.header: Items for the header region.
  60. * - page.featured: Items for the featured region.
  61. * - page.highlighted: Items for the highlighted content region.
  62. * - page.help: Dynamic help text, mostly for admin pages.
  63. * - page.content: The main content of the current page.
  64. * - page.sidebar_first: Items for the first sidebar.
  65. * - page.sidebar_second: Items for the second sidebar.
  66. * - page.triptych_first: Items for the first triptych.
  67. * - page.triptych_middle: Items for the middle triptych.
  68. * - page.triptych_last: Items for the last triptych.
  69. * - page.footer_firstcolumn: Items for the first footer column.
  70. * - page.footer_secondcolumn: Items for the second footer column.
  71. * - page.footer_thirdcolumn: Items for the third footer column.
  72. * - page.footer_fourthcolumn: Items for the fourth footer column.
  73. * - page.footer: Items for the footer region.
  74. *
  75. * @see template_preprocess()
  76. * @see template_preprocess_page()
  77. * @see bartik_preprocess_page()
  78. * @see template_process()
  79. * @see template_process_page()
  80. * @see bartik_process_page()
  81. * @see html.html.twig
  82. *
  83. * @ingroup themeable
  84. */
  85. #}
  86. <div id="page-wrapper"><div id="page">
  87. <header id="header" class="{{ secondary_menu ? 'with-secondary-menu' : 'without-secondary-menu' }}" role="banner"><div class="section clearfix">
  88. {% if secondary_menu %}
  89. <nav id="secondary-menu" class="navigation" role="navigation">
  90. {{ secondary_menu }}
  91. </nav> <!-- /#secondary-menu -->
  92. {% endif %}
  93. {% if logo %}
  94. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home" id="logo">
  95. <img src="{{ logo }}" alt="{{ 'Home'|t }}" />
  96. </a>
  97. {% endif %}
  98. {% if site_name or site_slogan %}
  99. <div id="name-and-slogan"{% if hide_site_name and hide_site_slogan %} class="element-invisible"{% endif %}>
  100. {% if site_name %}
  101. {% if title %}
  102. <div id="site-name"{% if hide_site_name %} class="element-invisible"{% endif %}>
  103. <strong>
  104. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home"><span>{{ site_name }}</span></a>
  105. </strong>
  106. </div>
  107. {# Use h1 when the content title is empty #}
  108. {% else %}
  109. <h1 id="site-name"{% if hide_site_name %} class="element-invisible" {% endif %}>
  110. <a href="{{ front_page }}" title="{{ 'Home'|t }}" rel="home"><span>{{ site_name }}</span></a>
  111. </h1>
  112. {% endif %}
  113. {% endif %}
  114. {% if site_slogan %}
  115. <div id="site-slogan"{% if hide_site_slogan %} class="element-invisible"{% endif %}>
  116. {{ site_slogan }}
  117. </div>
  118. {% endif %}
  119. </div><!-- /#name-and-slogan -->
  120. {% endif %}
  121. {{ page.header }}
  122. {% if main_menu %}
  123. <nav id ="main-menu" class="navigation" role="navigation">
  124. {{ main_menu }}
  125. </nav> <!-- /#main-menu -->
  126. {% endif %}
  127. </div></header> <!-- /.section, /#header-->
  128. {% if messages %}
  129. <div id="messages"><div class="section clearfix">
  130. {{ messages }}
  131. </div></div> <!-- /.section, /#messages -->
  132. {% endif %}
  133. {% if page.featured %}
  134. <aside id="featured"><div class="section clearfix">
  135. {{ page.featured }}
  136. </div></aside> <!-- /.section, /#featured -->
  137. {% endif %}
  138. <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">
  139. {{ breadcrumb }}
  140. <main id="content" class="column" role="main"><section class="section">
  141. {% if page.highlighted %}<div id="highlighted">{{ page.highlighted }}</div>{% endif %}
  142. <a id="main-content"></a>
  143. {{ title_prefix }}
  144. {% if title %}
  145. <h1 class="title" id="page-title">
  146. {{ title }}
  147. </h1>
  148. {% endif %}
  149. {{ title_suffix }}
  150. {% if tabs %}
  151. <nav class="tabs" role="navigation">
  152. {{ tabs }}
  153. </nav>
  154. {% endif %}
  155. {{ page.help }}
  156. {% if action_links %}
  157. <ul class="action-links">
  158. {{ action_links }}
  159. </ul>
  160. {% endif %}
  161. {{ page.content }}
  162. {{ feed_icons }}
  163. </section></main> <!-- /.section, /#content -->
  164. {% if page.sidebar_first %}
  165. <div id="sidebar-first" class="column sidebar"><aside class="section">
  166. {{ page.sidebar_first }}
  167. </aside></div><!-- /.section, /#sidebar-first -->
  168. {% endif %}
  169. {% if page.sidebar_second %}
  170. <div id="sidebar-second" class="column sidebar"><aside class="section">
  171. {{ page.sidebar_second }}
  172. </aside></div><!-- /.section, /#sidebar-second -->
  173. {% endif %}
  174. </div></div><!-- /#main, /#main-wrapper -->
  175. {% if page.triptych_first or page.triptych_middle or page.triptych_last %}
  176. <div id="triptych-wrapper"><aside id="triptych" class="clearfix">
  177. {{ page.triptych_first }}
  178. {{ page.triptych_middle }}
  179. {{ page.triptych_last }}
  180. </aside></div><!-- /#triptych, /#triptych-wrapper -->
  181. {% endif %}
  182. <div id="footer-wrapper"><footer class="section">
  183. {% if page.footer_firstcolumn or page.footer_secondcolumn or page.footer_thirdcolumn or page.footer_fourthcolumn %}
  184. <div id="footer-columns" class="clearfix">
  185. {{ page.footer_firstcolumn }}
  186. {{ page.footer_secondcolumn }}
  187. {{ page.footer_thirdcolumn }}
  188. {{ page.footer_fourthcolumn }}
  189. </div><!-- /#footer-columns -->
  190. {% endif %}
  191. {% if page.footer %}
  192. <div id="footer" role="contentinfo" class="clearfix">
  193. {{ page.footer }}
  194. </div> <!-- /#footer -->
  195. {% endif %}
  196. </footer></div> <!-- /.section, /#footer-wrapper -->
  197. </div></div> <!-- /#page, /#page-wrapper -->

Related topics