my-cta.twig

Same filename and directory in other branches
  1. 10 core/modules/system/tests/modules/sdc_test/components/my-cta/my-cta.twig
{% if target is not empty %}
  {% set attributes = attributes.setAttribute('target', target) %}
{% endif %}
{% if variant is not empty %}
  {% set attributes = attributes.addClass('my-cta-' ~ variant) %}
{% endif %}

<a {{ attributes }} href="{{ href }}">
  {{ text }}
</a>

File

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

View source
  1. {% if target is not empty %}
  2. {% set attributes = attributes.setAttribute('target', target) %}
  3. {% endif %}
  4. {% if variant is not empty %}
  5. {% set attributes = attributes.addClass('my-cta-' ~ variant) %}
  6. {% endif %}
  7. <a {{ attributes }} href="{{ href }}">
  8. {{ text }}
  9. </a>

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