lb_grid_cta-1.0.1/modules/lb_grid_icon/templates/block--lb-icon-grid.html.twig

modules/lb_grid_icon/templates/block--lb-icon-grid.html.twig
{#
/**
 * @file
 * Theme override to display a block.
 *
 * Available variables:
 * - 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.
 * - block_content: Block content entity instance.
 * - items: Referenced paragraph instances for the Grid CTA items.
 * - columns: Columns count for the layout configuration.
 *
 * @see template_preprocess_block()
 * @see template_preprocess_block__lb_grid_cta()
 */
#}
{% set classes = [
  'container',
  'block',
  'block--spacing',
  'block-' ~ configuration.provider|clean_class,
  'block-' ~ plugin_id|clean_class,
  'lb-icon-grid'
] %}

{% set cta_icons_id = 'cta-icons-' ~ configuration['block_revision_id'] %}
{{ attach_library('lb_grid_icon/lb_grid_icon') }}
<div{{ attributes.addClass(classes).setAttribute('id', plugin_id|clean_class ~ configuration['block_revision_id']) }}>
  {{ title_prefix }}
  {{ title_suffix }}
  {% block content %}
    {% if block_content.field_section_title is not empty %}
      <div class="row section-description text-align-center">
        <div class="col-12">
          <h2{{ title_attributes }}>{{ block_content.field_section_title.value }}</h2>
          {% if block_content.field_section_subtitle is not empty %}
            <p>{{ block_content.field_section_subtitle.value|raw }}</p>
          {% endif %}
        </div>
      </div>
    {% endif %}
    <div id="{{ cta_icons_id }}">
      {% if items is not empty %}
        <div
          class="row row-cols-1 row-cols-lg-{{ columns }} g-{{ columns }} justify-content-center">
          {% for key, item in items %}

            {% set image = false %}
            {% set media_image = false %}
            {% set safe_hash = configuration['block_revision_id'] ~ '--' ~ loop.index %}
            {% set cta_attr = create_attribute() %}
            {% set cta_classes = [
              'cta_icon-item',
              'col',
              'text-center',
            ] %}
            {% if item.field_media and item.field_media.0.entity.field_media_image.entity %}
              {% set media_image = item.field_media.0.entity.field_media_image.entity.uri.value %}
              {% set image_alt = item.field_media.0.entity.image.0.alt %}
            {% endif %}
           {# Setup our SVG or image style. #}
            {% if media_image %}
              {% if '.svg' in media_image %}
                {% set image = file_url(media_image) %}
              {% else %}
                {% set image = file_url(media_image|image_style('icon_image')) %}
              {% endif %}
            {% endif %}

            <div{{ cta_attr.addClass(cta_classes) }}>
              <div class="card h-100 border-0">
                {# image #}
                {% if image %}
                  <img src="{{ image }}" alt="{{ image_alt }}" class="rounded-circle mb-4 mx-auto" role="presentation">
                {% endif %}
                <div class="card-body">
                  {# title #}
                  {% if item.field_title %}
                    <h3
                      class="card-title">{{ item.field_title.value }}</h3>
                  {% endif %}
                  {# body #}
                  {% if item.field_description %}
                    {{ item.field_description|view({label: 'hidden'})|raw }}
                  {% endif %}
                </div>
              </div>
            </div>
          {% endfor %}
        </div>
      {% endif %}
    </div>
    {% if block_content.field_cta.uri is not empty %}
      <div class="row section-cta justify-content-center">
        <a href="{{ block_content.field_cta.0.url }}"
           class="btn btn-primary filled">{{ block_content.field_cta.title }}</a>
      </div>
    {% endif %}
  {% endblock %}

</div>

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

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