bootstrap_italia-8.x-0.x-dev/components/components-2/demo-container.html.twig

components/components-2/demo-container.html.twig
{#
/**
 * @file
 * Demo container.
 *
 * Example:
 *
    {% embed '@bi-bcl/demo-container.html.twig' with {
      title: 'Title'|t,
    } %}
      {% block content %}
        Your content
      {% endblock %}
    {% endembed %}
 */
#}
{% apply spaceless %}
  {# Set defaults #}
  {% set _title = title|default('') %}
  {% set _demo_classes = demo_classes|default('') %}
  {% set _demo_attributes = demo_attributes|default('') %}
  {% set _base_url_demo_code = base_url_demo_code|default('https://git.drupalcode.org/project/bootstrap_italia/-/blob/2.12.x/components/components-2') %}
  {% set _path_demo_code = path_demo_code|default('') %}

  {# Set options #}
  {% set _classes = [
    'mb-5',
    'py-4',
    'bd-example','border','rounded','p-1','p-md-2','p-lg-3'
  ] %}

  {% if _demo_classes is not empty %}
    {% set _classes = _classes|merge(demo_classes) %}
  {% endif %}

  {% if _demo_attributes is empty %}
    {% set demo_attributes = create_attribute() %}
  {% endif %}
  {% set demo_attributes = demo_attributes.addClass(_classes) %}

  {# Component #}
  {% if title is not empty %}
    <h3 class="mt-4 mb-3 fw-semibold border-bottom">
      {{ _title }}
      {% if _path_demo_code is not empty %}
        <a href="{{ _base_url_demo_code ~ _path_demo_code }}" title="{{ 'View code'|t }}" target="_blank">
          <span class="visually-hidden">{{ 'Go to example code in new window'|t }}</span>
          {% include '@bi-bcl/icon/icon.html.twig' with {
            name: 'it-code-circle',
            color: 'primary',
            icon_classes: ['pb-1']
          } %}
        </a>
      {% endif %}
    </h3>
  {% endif %}

  <div{{ demo_attributes }}>
    {% block content %}
      Your content
    {% endblock %}
  </div>
{% endapply %}

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

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