drowl_paragraphs_bs-1.x-dev/modules/drowl_paragraphs_bs_type_icon/templates/paragraph--drowl-paragraphs-bs--icon.html.twig

modules/drowl_paragraphs_bs_type_icon/templates/paragraph--drowl-paragraphs-bs--icon.html.twig
{% extends "@drowl_paragraphs_bs/paragraph--drowl-paragraphs-bs.html.twig" %}
  {#
  /**
   * @file
   * Default theme implementation to display a paragraph.
   *
   * Available variables:
   * - paragraph: Full paragraph entity.
   *   Only method names starting with "get", "has", or "is" and a few common
   *   methods such as "id", "label", and "bundle" are available. For example:
   *   - paragraph.getCreatedTime() will return the paragraph creation timestamp.
   *   - paragraph.id(): The paragraph ID.
   *   - paragraph.bundle(): The type of the paragraph, for example, "image" or "text".
   *   - paragraph.getOwnerId(): The user ID of the paragraph author.
   *   See Drupal\paragraphs\Entity\Paragraph for a full list of public properties
   *   and methods for the paragraph object.
   * - content: All paragraph items. Use {{ content }} to print them all,
   *   or print a subset such as {{ content.field_example }}. Use
   *   {{ content|without('field_example') }} to temporarily suppress the printing
   *   of a given child element.
   * - attributes: HTML attributes for the containing element.
   *   The attributes.class element may contain one or more of the following
   *   classes:
   *   - paragraphs: The current template type (also known as a "theming hook").
   *   - paragraphs--type-[type]: The current paragraphs type. For example, if the paragraph is an
   *     "Image" it would result in "paragraphs--type--image". Note that the machine
   *     name will often be in a short form of the human readable label.
   *   - paragraphs--view-mode--[view_mode]: The View Mode of the paragraph; for example, a
   *     preview would result in: "paragraphs--view-mode--preview", and
   *     default: "paragraphs--view-mode--default".
   * - view_mode: View mode; for example, "preview" or "full".
   * - logged_in: Flag for authenticated user status. Will be true when the
   *   current user is a logged-in member.
   * - is_admin: Flag for admin user status. Will be true when the current user
   *   is an administrator.
   *
   * % extends "paragraph.html.twig" %
   * @see template_preprocess_paragraph()
   *
   * @ingroup themeable
   */
  #}

  {# Determine if there is any text contetn, or just the icon #}
  {% if content.field_title.0 or content.field_text.0 %}
    {% set has_any_text = true %}
  {% else %}
    {% set has_any_text = false %}
  {% endif %}

  {#
    Icon-combo classes
    Formatter classes are set using ui_styles.
    You can add further formatters adding ui_style classes prefixed with "icon-combo__".
  #}
  {%
    set icon_combo_classes = [
      'icon-combo',
      paragraph.field_link.0 ? 'icon-combo--linked'
    ]
  %}

  {#
    Icon classes (<i>)
    Formatter classes are set using ui_styles.
    You can add further formatters adding ui_style classes prefixed with "icon__".
  #}
  {%
    set icon_classes = [
      'icon-combo__icon',
      'ico',
      paragraph.field_icon.0 ? paragraph.field_icon.value|clean_class
    ]
  %}

  {% block content %}
    {% if content.field_link.0 %}
      <a{{ icon_combo_attributes.addClass(icon_combo_classes) }} href="{{ paragraph.field_link.0.url.toString }}"{% if paragraph.field_link.0.url.external %} target="_blank"{% endif %}>
    {% else %}
      <div{{ icon_combo_attributes.addClass(icon_combo_classes) }}>
    {% endif %}
      {% block icon %}
        {% if content.field_icon.0 %}
          <i{{ icon_attributes.addClass(icon_classes) }}></i>
        {% endif %}
      {% endblock icon %}
      {% block text_wrapper %}
        {% if has_any_text %}
          <div class="icon-combo__text-wrapper">
            {% block title_subline %}
              {% if content.field_title.0 %}
                {% block title %}
                  <h3 class="icon-combo__heading{% if content.field_subtitle.0 %} has-subline{% endif %}">
                    {{ content.field_title|field_value }}
                  </h3>
                {% endblock title %}
                {% block subline %}
                  {% if content.field_subtitle.0 %}
                    <div class="icon-combo__subline subline">
                      {{ content.field_subtitle|field_value }}
                    </div>
                  {% endif %}
                {% endblock subline %}
              {% endif %}
            {% endblock title_subline %}
            {% block text %}
              {% if content.field_text.0 %}
                {% if content.field_link.0 %}
                  {# We need to remove links from field_text to prevent issues with the outer icon-combo link. #}
                  <div class="icon-combo__text">{{ content.field_text.0['#text']|striptags('<br><p><span><hr><div><span><strong><b><em><i>')|raw }}</div>
                {% else %}
                  <div class="icon-combo__text">{{ content.field_text|field_value }}</div>
                {% endif %}
              {% endif %}
            {% endblock text %}
          </div>
        {% endif %}
      {% endblock text_wrapper %}
    {% if content.field_link.0 %}
      </a>
    {% else %}
      </div>
    {% endif %}
  {% endblock content %}

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

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