rocketship_core-8.x-2.0-alpha11/templates/ds/rocketship-layout-321col.html.twig

templates/ds/rocketship-layout-321col.html.twig
{#
/**
 * @file
 * Template for a rocketship 3 column layout.
 *
 * Available variables:
 * - top: top region
 * - header: header region
 * - primary: sidebar region
 * - secondary: sidebar region
 * - main: main content region
 * - footer: footer region
 * - bottom: bottom region
 */
#}

{# no sidebars by default #}
{% set sidebars = false %}
{% set layoutType = '1col' %}
{% set layoutModifier = 'no-sidebars' %}
{% set classMain = '' %}
{% set classAsideLeft = '' %}
{% set classAsideRight = '' %}

{# If left and right sidebar content #}
{% if (content.first is not empty and content.first|render|striptags|length) and (content.second is not empty and content.second|render|striptags|length) %}
  {% set sidebars = true %}
  {% set layoutType = '3col' %}
  {% set layoutModifier = 'sidebars' %}
  {% set classMain = 'center' %}
  {% set classAsideLeft = 'left' %}
  {% set classAsideRight = 'right' %}

{# If left but no right sidebar content #}
{% elseif content.first is not empty and content.first|render|striptags|length %}
  {% set sidebars = true %}
  {% set layoutType = '2col' %}
  {% set layoutModifier = 'sidebar-primary' %}
  {% set classMain = 'right' %}
  {% set classAsideLeft = 'left' %}

{# If right but no left sidebar content #}
{% elseif content.second is not empty and content.second|render|striptags|length %}
  {% set sidebars = true %}
  {% set layoutType = '2col' %}
  {% set layoutModifier = 'sidebar-secondary' %}
  {% set classMain = 'left' %}
  {% set classAsideRight = 'right' %}
{% 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--' ~ layoutType,
    '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 %}

  {% if (content.content is not empty) or (content.first is not empty) or (content.second is not empty) %}

    {% if sidebars != false %}
    <div class="layout__cols layout__cols--main layout__cols--{{layoutModifier}}--{{classAsideLeft}} {{'layout__' ~ 'cols' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
    {% endif %}

      {% if content.first is not empty and content.first|render|striptags|length %}
        <aside class="layout__region layout__sidebar layout__sidebar--{{layoutModifier}}--{{classAsideLeft}} {{'layout__' ~ 'sidebar' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode  ~ '--' ~ classAsideLeft }}">
          {{ content.first }}
        </aside>
      {% endif %}

      {% if content.content is not empty and content.content|render|striptags|length %}
        {% if classMain|length %}
        <div class="layout__region layout__content layout__content--{{layoutModifier}}--{{classMain}} {{'layout__' ~ 'content' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode  ~ '--' ~ classMain }}">
        {% else %}
        <div class="layout__region layout__content layout__content--{{layoutModifier}} {{'layout__' ~ 'content' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
        {% endif %}
        {{ content.content }}
        </div>
      {% endif %}

      {% if content.second is not empty and content.second|render|striptags|length %}
        <aside class="layout__region layout__sidebar layout__sidebar--{{layoutModifier}}--{{classAsideRight}} {{'layout__' ~ 'sidebar' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode  ~ '--' ~ classAsideRight }}">
          {{ content.second }}
        </aside>
      {% endif %}

    {% if sidebars != false %}
    </div>
    {% endif %}

  {% endif %}

  {% 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>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc