my-banner.twig

Same filename and directory in other branches
  1. 10 core/modules/system/tests/modules/sdc_test/components/my-banner/my-banner.twig
{# Prepare presentational attributes #}
{% if image is not empty %}
  {% set attributes = attributes.setAttribute('style', 'background-image: linear-gradient(to right, black, black, rgba(0, 0, 0, 70%), transparent), url("' ~ image ~ '");') %}
{% endif %}

{# Markup for the component #}
<div {{ attributes }}>
  <div class="component--my-banner--header">
    <h3>{{ heading }}</h3>
    {% include 'sdc_test:my-cta' with { text: ctaText, href: ctaHref, target: ctaTarget } only %}
  </div>
  <div class="component--my-banner--body">
    {% block banner_body %}
    {% endblock %}
  </div>
</div>

File

core/modules/system/tests/modules/sdc_test/components/my-banner/my-banner.twig

View source
  1. {# Prepare presentational attributes #}
  2. {% if image is not empty %}
  3. {% set attributes = attributes.setAttribute('style', 'background-image: linear-gradient(to right, black, black, rgba(0, 0, 0, 70%), transparent), url("' ~ image ~ '");') %}
  4. {% endif %}
  5. {# Markup for the component #}
  6. <div {{ attributes }}>
  7. <div class="component--my-banner--header">
  8. <h3>{{ heading }}</h3>
  9. {% include 'sdc_test:my-cta' with { text: ctaText, href: ctaHref, target: ctaTarget } only %}
  10. </div>
  11. <div class="component--my-banner--body">
  12. {% block banner_body %}
  13. {% endblock %}
  14. </div>
  15. </div>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.