dxpr_theme-5.0.1/templates/page.html.twig
templates/page.html.twig
{#
/**
* @file
* Default 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 in this 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.
*
* Navigation:
* - 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.
* - 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.secondary_header: Items for the secondary header region
* - page.header: Items for the header region.
* - page.navigation: Items for the navigation region.
* - page.navigation_collapsible: Items for the navigation (collapsible) 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.
*
* @ingroup templates
*
* @see template_preprocess_page()
* @see html.html.twig
*/
#}
{%- macro hasContent(region) -%}
{%- set keep_tags = '<drupal-render-placeholder><form><embed><hr><iframe><img><input><link><object><script><source><style><video>' -%}
{%- set content = region|render|replace({"\n": "", "\r": "", "\t": ""})|striptags(keep_tags)|trim -%}
{{- content ? 'TRUE' -}}
{%- endmacro -%}
{% if not node.field_dth_page_layout.getString() and theme.settings.boxed_layout
or node.field_dth_page_layout.getString() == 'boxed' %}
<div class="dxpr-theme-boxed-container">
{% endif %}
{# Secondary Header #}
{% if page.secondary_header %}
{% block secondary_header %}
{% set container = theme.settings.full_width_containers.cnt_secondary_header ? 'dxpr-theme-fluid' : 'container' %}
<header id="secondary-header" class="dxpr-theme-secondary-header clearfix {{ theme.settings.secondary_header_hide|clean_class }}" role="banner">
<div class="{{ container }} secondary-header-container">
{% if not theme.settings.full_width_containers.cnt_secondary_header %}
<div class="row container-row"><div class="col-sm-12 container-col">
{% endif %}
{{ page.secondary_header }}
{% if not theme.settings.full_width_containers.cnt_secondary_header %}
</div></div>
{% endif %}
</div>
</header>
{% endblock %}
{% endif %}
{# Navbar #}
{% if page.navigation or page.navigation_collapsible %}
{% block navbar %}
{% if theme.settings.header_position %}
{%
set navbar_classes = [
'navbar dxpr-theme-header dxpr-theme-header--top',
theme.settings.navbar_position ? 'navbar-is-' ~ theme.settings.navbar_position,
theme.settings.header_side_align,
]
%}
{% else %}
{%
set navbar_classes = [
'navbar dxpr-theme-header clearfix',
theme.settings.header_position ? 'dxpr-theme-header--side' : 'dxpr-theme-header--top',
theme.settings.navbar_position ? 'navbar-is-' ~ theme.settings.navbar_position,
theme.settings.header_top_layout ? 'dxpr-theme-header--' ~ theme.settings.header_top_layout|clean_class,
theme.settings.header_style ? 'dxpr-theme-header--' ~ theme.settings.header_style|clean_class,
theme.settings.menu_hover ? 'dxpr-theme-header--hover-' ~ theme.settings.menu_hover|clean_class,
theme.settings.header_top_fixed and theme.settings.header_top_sticky ? 'dxpr-theme-header--sticky',
theme.settings.header_top_fixed and not theme.settings.header_top_sticky ? 'dxpr-theme-header--fixed',
]
%}
{% endif %}
{% set mark_menu = theme.settings.mark_menu_with_children ? 'dxpr-theme-menu--has-children' : '' %}
{% set navbar_attributes = navbar_attributes.removeClass('container').addClass(navbar_classes) %}
{% if theme.settings.header_top_fixed and theme.settings.header_top_sticky %}
{% set navbar_attributes = navbar_attributes.setAttribute('data-spy', 'affix').setAttribute('data-offset-top', theme.settings.header_top_height_sticky_offset) %}
{% endif %}
{% set hamburger_menu = theme.settings.hamburger_menu ? theme.settings.hamburger_menu : 'three-dash' %}
<header{{ navbar_attributes }}>
{% set container = theme.settings.full_width_containers.cnt_header_nav ? 'dxpr-theme-fluid' : 'container' %}
<div class="{{ container }} navbar-container">
{% if not theme.settings.full_width_containers.cnt_header_nav%}
<div class="row container-row"><div class="col-sm-12 container-col">
{% endif %}
<div class="navbar-header">
{{ page.navigation }}
{# .btn-navbar is used as the toggle for collapsed navbar content #}
{% if page.navigation_collapsible %}
<a id="dxpr-theme-menu-toggle" href="#" class="{{ hamburger_menu }}"><span></span><div class="screenreader-text visually-hidden">Toggle menu</div></a>
{% endif %}
</div>
{# Navigation (collapsible) #}
{% if page.navigation_collapsible %}
<nav role="navigation" id="dxpr-theme-main-menu" class="dxpr-theme-main-menu {{ mark_menu }}">
{{ page.navigation_collapsible }}
</nav>
{% endif %}
{% if not theme.settings.full_width_containers.cnt_header_nav%}
</div></div>
{% endif %}
</div>
</header>
{% endblock %}
{% endif %}
<div class="wrap-containers">
{# Highlighted #}
{% if page.highlighted %}
{% block highlighted %}
{{ page.highlighted }}
{% endblock %}
{% endif %}
{# Page Title #}
{% if page.page_title and not (theme.settings.page_title_home_hide and is_front) %}
{% block page_title %}
{% if title_bg_image_path %}
<style>
#page-title-full-width-container::after{ background-image:url({{ file_url(title_bg_image_path) }});}
</style>
{% endif %}
<div{{ page_title_attributes }} class="page-title-full-width-container" id="page-title-full-width-container">
{% set container = theme.settings.full_width_containers.cnt_page_title ? 'dxpr-theme-fluid' : 'container' %}
<header role="banner" id="page-title" class="{{ container }} page-title-container">
{{ page.page_title }}
</header>
</div>
{% endblock %}
{% endif %}
{# Content Top #}
{% if page.content_top %}
{% block content_top %}
{% set container = theme.settings.full_width_containers.cnt_content_top ? 'dxpr-theme-fluid' : 'container' %}
<div class="{{ container }} content-top-container">
{% if not theme.settings.full_width_containers.cnt_content_top %}
<div class="row container-row"><div class="col-sm-12 container-col">
{% endif %}
{{ page.content_top }}
{% if not theme.settings.full_width_containers.cnt_content_top %}
</div></div>
{% endif %}
</div>
{% endblock %}
{% endif %}
{# Main #}
{% block main %}
{% set has_sidebar_first = _self.hasContent(page.sidebar_first) %}
{% set has_sidebar_second = _self.hasContent(page.sidebar_second) %}
{% set container = theme.settings.full_width_containers.cnt_content
or node.field_dth_main_content_width.getString() == 'dxpr-theme-util-full-width-content'
or node and attribute(theme.settings.full_width_content_types, node.getType)
and not has_sidebar_first
and not has_sidebar_second ? '' : 'container' %}
<div role="main" class="main-container {{ container }} js-quickedit-main-content clearfix">
{% if container != '' %}
<div class="row">
{% endif %}
{# Sidebar First #}
{% if has_sidebar_first %}
{% block sidebar_first %}
<aside class="col-sm-3" role="complementary">
{{ page.sidebar_first }}
</aside>
{% endblock %}
{% endif %}
{# Content #}
{% if not node.field_dth_main_content_width.getString() %}
{%
set content_classes = [
has_sidebar_first and has_sidebar_second ? 'col-sm-6',
has_sidebar_first and not has_sidebar_second ? 'col-sm-9',
has_sidebar_second and not has_sidebar_first ? 'col-sm-9',
container != '' and not has_sidebar_first and not has_sidebar_second ? 'col-sm-12'
]
%}
{% else %}
{% set col = node.field_dth_main_content_width.getString() %}
{%
set content_classes = [
col == 'dxpr-theme-util-content-center-4-col' ? 'col-md-4 offset-md-4',
col == 'dxpr-theme-util-content-center-6-col' ? 'col-md-6 offset-md-3',
col == 'dxpr-theme-util-content-center-8-col' ? 'col-md-8 offset-md-2',
col == 'dxpr-theme-util-content-center-10-col' ? 'col-md-10 offset-md-1',
]
%}
{% endif %}
<section{{ content_attributes.addClass(content_classes) }}>
{# Action Links #}
{% if action_links %}
{% block action_links %}
<ul class="action-links" style="border: 2px dashed blue">{{ action_links }}</ul>
{% endblock %}
{% endif %}
{# Help #}
{% if page.help %}
{% block help %}
{{ page.help }}
{% endblock %}
{% endif %}
{# Content #}
{% block content %}
<a id="main-content"></a>
{{ page.content }}
{% endblock %}
</section>
{# Sidebar Second #}
{% if has_sidebar_second %}
{% block sidebar_second %}
<aside class="col-sm-3" role="complementary">
{{ page.sidebar_second }}
</aside>
{% endblock %}
{% endif %}
{% if container != '' %}
</div><!-- end .ow -->
{% endif %}
</div><!-- end main-container -->
{% endblock %}
{# Content Bottom #}
{% if page.content_bottom %}
{% block content_bottom %}
{% set container = theme.settings.full_width_containers.cnt_content_bottom ? 'dxpr-theme-fluid' : 'container' %}
<div class="{{ container }} content-bottom-container">
{% if not theme.settings.full_width_containers.cnt_content_bottom %}
<div class="row container-row"><div class="col-sm-12 container-col">
{% endif %}
{{ page.content_bottom }}
{% if not theme.settings.full_width_containers.cnt_content_bottom %}
</div></div>
{% endif %}
</div>
{% endblock %}
{% endif %}
</div>
{# Footer #}
{% if page.footer %}
{% block footer %}
<footer class="dxpr-theme-footer clearfix" role="contentinfo">
{% set container = theme.settings.full_width_containers.cnt_footer ? 'dxpr-theme-fluid' : 'container' %}
<div class="{{ container }} footer-container">
{% if not theme.settings.full_width_containers.cnt_footer %}
<div class="row container-row"><div class="col-sm-12 container-col">
{% endif %}
{{ page.footer }}
{% if not theme.settings.full_width_containers.cnt_footer %}
</div></div>
{% endif %}
</div>
</footer>
{% endblock %}
{% endif %}
{% if not node.field_dth_page_layout.getString() and theme.settings.boxed_layout
or node.field_dth_page_layout.getString() == 'boxed' %}
</div><!-- end dxpr-theme-boxed-container -->
{% endif %}
