Commit 08a9163c authored by Simone Wood's avatar Simone Wood
Browse files

Issue #3273854 by sim_1, erutan: Template updates to keep up with Core

parent 6c69334a
Loading
Loading
Loading
Loading
+25 −33
Original line number Diff line number Diff line
{#
/**
 * @file
 * Default theme implementation to display a block.
 * Theme override to display a block.
 *
 * Available variables:
 * - block.subject: Block title.
 * - content: Block content.
 * - block.module: Module that generated the block.
 * - block.delta: An ID for the block, unique within each module.
 * - block.region: The block region embedding the current block.
 * - classes: String of classes that can be used to style contextually through
 *   CSS. It can be manipulated through the variable classes_array from
 *   preprocess functions. The default values can be one or more of the following:
 *   - block: The current template type, i.e., "theming hook".
 *   - block-[module]: The module generating the block. For example, the user module
 *     is responsible for handling the default user navigation block. In that case
 *     the class would be "block-user".
 * - title_prefix (array): An array containing additional output populated by
 *   modules, intended to be displayed in front of the main title tag that
 *   appears in the template.
 * - title_suffix (array): An array containing additional output populated by
 *   modules, intended to be displayed after the main title tag that appears in
 *   the template.
 * - plugin_id: The ID of the block implementation.
 * - label: The configured label of the block if visible.
 * - configuration: A list of the block's configuration values.
 *   - label: The configured label for the block.
 *   - label_display: The display settings for the label.
 *   - provider: The module or other provider that provided this block plugin.
 *   - Block plugin specific settings will also be stored here.
 * - content: The content of this block.
 * - attributes: array of HTML attributes populated by modules, intended to
 *   be added to the main container tag of this template.
 *   - id: A valid HTML ID and guaranteed unique.
 * - title_attributes: Same as attributes, except applied to the main title
 *   tag that appears in the template.
 * - title_prefix: Additional output populated by modules, intended to be
 *   displayed in front of the main title tag that appears in the template.
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
 *
 * Helper variables:
 * Foundation Helper variables:
 * - classes_array: Array of html class attribute values. It is flattened
 *   into a string within the variable classes.
 * - block_zebra: Outputs 'odd' and 'even' dependent on each block region.
@@ -37,12 +36,9 @@
 * - content_attributes: Raw HTML attributes for block content.
 * - title_attributes: Raw HTML attributes for the block title tag.
 *
 * @see template_preprocess()
 * @see template_preprocess_block()
 * @see template_process()
 */
#}
{% if block.delta != 'main' %}
{%
  set classes = [
  'block',
@@ -50,9 +46,7 @@
  'block-' ~ plugin_id|clean_class,
]
%}
<section{{ attributes.addClass(classes) }}>
  {% endif %}

<div{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label %}
    <h2 {{ title_attributes }}>{{ label }}</h2>
@@ -71,6 +65,4 @@
  </div>
  {% endif %}

  {% if block.delta != 'main' %}
</section>
{% endif %}
</div>
+11 −11
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
#}
{% if breadcrumb %}
  <nav role="navigation" aria-labelledby="system-breadcrumb">
    <h2 id="system-breadcrumb" class="visually-hidden">{{ 'You are here'|t }}</h2>
    <h2 id="system-breadcrumb" class="show-for-sr">{{ 'Breadcrumb'|t }}</h2>
    <ul class="breadcrumbs">
      {% for item in breadcrumb %}
        <li>
@@ -21,7 +21,7 @@
          {% endif %}
        </li>
      {% endfor %}
      <li class="current"><a href="#">{{ title }}</a></li>
      <li class="current"><span class="show-for-sr">Current: </span> {{ title }}</li>
    </ul>
  </nav>
{% endif %}
+31 −14
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
 * - label_hidden: Whether to show the field label or not.
 * - title_attributes: HTML attributes for the title.
 * - label: The label for the field.
 * - content_attributes: HTML attributes for the content.
 * - multiple: TRUE if a field can contain multiple items.
 * - items: List of all the field items. Each item contains:
 *   - attributes: List of HTML attributes for each item.
 *   - content: The field item's content.
@@ -36,30 +36,47 @@
 * @see template_preprocess_field()
 */
#}
{% set field_name_class = field_name|clean_class %}
{%
  set classes = [
    'field',
    'field-' ~ entity_type|clean_class ~ '--' ~ field_name_class,
    'field-name-' ~ field_name_class,
    'field-type-' ~ field_type|clean_class,
    'field-label-' ~ label_display,
    'field--' ~ entity_type|clean_class ~ '-' ~ field_name|clean_class,
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
    label_display == 'inline' ? 'clearfix',
  ]
%}
{%
  set title_classes = [
    'field-label',
    label_display == 'visually_hidden' ? 'visually-hidden',
    label_display == 'visually_hidden' ? 'show-for-sr',
  ]
%}

{% if label_hidden %}
  {% if multiple %}
    <div{{ attributes.addClass(classes, 'field__items') }}>
      {% for item in items %}
        <div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
      {% endfor %}
    </div>
  {% else %}
    {% for item in items %}
      <div{{ attributes.addClass(classes, 'field__item') }}>{{ item.content }}</div>
    {% endfor %}
  {% endif %}
{% else %}
  <div{{ attributes.addClass(classes) }}>
  {% if not label_hidden %}
    <div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
    {% if multiple %}
    <div class="field__items">
      {% endif %}
  <div{{ content_attributes.addClass('field-items') }}>
      {% for item in items %}
      <div{{ item.attributes.addClass('field-item') }}>{{ item.content }}</div>
        <div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
      {% endfor %}
      {% if multiple %}
    </div>
    {% endif %}
  </div>
{% endif %}
+2 −1
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@
{%
  set classes = [
    title_display == 'after' ? 'option',
    title_display == 'invisible' ? 'visually-hidden',
    title_display == 'invisible' ? 'show-for-sr',
    required ? 'js-form-required',
    required ? 'form-required',
  ]
%}
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@
  set description_classes = [
    'description',
    'help-text',
    description_display == 'invisible' ? 'visually-hidden',
    description_display == 'invisible' ? 'show-for-sr',
  ]
%}
<div{{ attributes.addClass(classes) }}>
Loading