Created
February 20, 2015 05:36
-
-
Save scor/9931b6ebf456caa356a6 to your computer and use it in GitHub Desktop.
Rendering a twitter ID as a link using Twig in Drupal 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div{{ attributes }}> | |
{% if not label_hidden %} | |
<div{{ title_attributes.addClass('field-label') }}>{{ label }}</div> | |
{% endif %} | |
<div{{ content_attributes.addClass('field-items') }}> | |
{% for item in items %} | |
<div{{ item.attributes.addClass('field-item') }}><a href="https://twitter.com/{{ item.content['#markup']|trim('@') }}">{{ item.content }}</a></div> | |
{% endfor %} | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment