{#
/**
 * @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 instance with all available fields
 * - image_position: Variable with image position left or right
 * - image_uri: Internal image URI to be used with file_url filter.
 *
 * @see template_preprocess_block()
 * @see template_preprocess_block__lb_ping_pong()
 */
#}
{% set classes = [
  'block',
  'block-' ~ configuration.provider|clean_class,
  'block-' ~ plugin_id|clean_class,
  'block-ping-pong-section',
] %}
{{ attach_library('small_y_ping_pongs/small_y_ping_pongs') }}
<div{{ attributes.addClass(classes).setAttribute('id', plugin_id|clean_class ~ configuration['block_revision_id']) }}>
  {{ title_prefix }}
  {{ title_suffix }}

  {% block block_content %}
    {% if block_content.field_section_title.value or block_content.field_section_subtitle.value %}
      <div class="row section-description">
        <div class="container">
          <div class="col-12 my-lg-5 my-3">
            <h2>{{ block_content.field_section_title.value }}</h2>
            <p>{{ block_content.field_section_subtitle.value }}</p>
          </div>
        </div>
      </div>
    {% endif %}

    {% if items %}
      <div class="ping-pong-items">
        {% for key, item in items %}
          {% block item_content %}
            <div class="row ping-pong-item no-gutters {% if image_position == 'right' %}background flex-md-row-reverse{% endif %}">
              {% embed '@lb_ping_pong/block--lb-ping-pong--content.html.twig' with {
                'title': item.field_item_title.value,
                'description': item.field_item_description.value,
                'image_uri': item.field_item_image.entity.field_media_image.entity.uri.value,
                'image_alt': item.field_item_image.entity.field_media_image.entity.alt,
                'links': item.field_item_cta,
              } %}
              {% endembed %}
            </div>
          {% endblock %}
        {% endfor %}
      </div>
    {% endif %}
  {% endblock %}
</div>
