rocketship_core-8.x-2.0-alpha11/templates/ds/rocketship-layout-2col.html.twig
templates/ds/rocketship-layout-2col.html.twig
{#
/**
* @file
* Template for a rocketship 2 column layout.
*
* Available variables:
* - top: top region
* - header: header region
* - sidebar: sidebar region
* - main: main content region
* - footer: footer region
* - bottom: bottom region
*/
#}
{% set reverse = reverse|default(false) %}
{% set layoutModifier = 'sidebar-primary' %}
{% set classAside = 'left' %}
{% set classMain = 'right' %}
{% if reverse %}
{% set layoutModifier = 'sidebar-secondary' %}
{% set classAside = 'right' %}
{% set classMain = 'left' %}
{% endif %}
{# classes for the template wrapper #}
{% set stickyClass = false %}
{% set promotedClass = false %}
{% if content['#node'] is defined %}
{% if content['#node'].get('promote') is defined and content['#node'].get('promote').value == 1 %}
{% set promotedClass = true %}
{% endif %}
{% if content['#node'].get('sticky') is defined and content['#node'].get('sticky').value == 1 %}
{% set stickyClass = true %}
{% endif %}
{% endif %}
{% set entityType = content['#entity_type']|replace('_', '-') %}
{% set bundle = content['#bundle']|replace('_', '-') %}
{% set viewMode = content['#view_mode']|replace('_', '-') %}
{%
set classes = [
'layout',
'layout--2col',
'layout--' ~ layoutModifier,
'clearfix',
'entity-type--' ~ content['#entity_type']|replace('_', '-'),
'bundle--' ~ content['#bundle']|replace('_', '-'),
'view-mode--' ~ content['#view_mode']|replace('_', '-'),
stickyClass ? 'is-sticky',
promotedClass ? 'is-promoted',
stickyClass ? content['#entity_type']|replace('_', '-') ~ '--type-' ~ content['#bundle']|replace('_', '-') ~ '--sticky',
promotedClass ? content['#entity_type']|replace('_', '-') ~ '--type-' ~ content['#bundle']|replace('_', '-') ~ '--promoted',
content['#bundle']|replace('_', '-') ~ '--' ~ content['#view_mode']|replace('_', '-'),
content['#entity_type']|replace('_', '-'),
content['#entity_type']|replace('_', '-') ~ '--' ~ 'type-' ~ content['#bundle']|replace('_', '-'),
content['#entity_type']|replace('_', '-') ~ '--' ~ 'view-mode-' ~ content['#view_mode']|replace('_', '-'),
]
%}
<div{{ attributes.addClass(classes|join(' ')) }}>
{% if title_suffix and title_suffix.contextual_links %}
{{ title_suffix.contextual_links }}
{% endif %}
{% if content.top is not empty and content.top|render|striptags|length %}
<div class="layout__region layout__top {{'layout__' ~ 'top' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{{ content.top }}
</div>
{% endif %}
{% if content.header is not empty and content.header|render|striptags|length %}
<header class="layout__region layout__header {{'layout__' ~ 'header' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{{ content.header }}
</header>
{% endif %}
<div class="layout__cols layout__cols--main layout__cols--{{layoutModifier}}--{{classAside}} {{'layout__' ~ 'cols' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{% if not reverse %}
<aside class="layout__region layout__sidebar layout__sidebar--{{layoutModifier}}--{{classAside}} {{'layout__' ~ 'sidebar' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode ~ '--' ~ classAside }}">
{% if content.first is not empty and content.first|render|striptags|length %}
{{ content.first }}
{% endif %}
</aside>
{% endif %}
<div class="layout__region layout__content layout__content--{{layoutModifier}}--{{classMain}} {{'layout__' ~ 'content' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode ~ '--' ~ classMain }}">
{% if content.content is not empty and content.content|render|striptags|length %}
{{ content.content }}
{% endif %}
</div>
{% if reverse %}
<aside class="layout__region layout__sidebar layout__sidebar--{{layoutModifier}}--{{classAside}} {{'layout__' ~ 'sidebar' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode ~ '--' ~ classAside }}">
{% if content.first is not empty and content.first|render|striptags|length %}
{{ content.first }}
{% endif %}
</aside>
{% endif %}
</div>
{% if content.footer is not empty and content.footer|render|striptags|length %}
<footer class="layout__region layout__footer {{'layout__' ~ 'footer' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{{ content.footer }}
</footer>
{% endif %}
{% if content.bottom is not empty and content.bottom|render|striptags|length %}
<div class="layout__region layout__bottom {{'layout__' ~ 'bottom' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{{ content.bottom }}
</div>
{% endif %}
</div>
