social-link-field-formatter.html.twig in Social Link Field 8
Default theme implementation to display a formatted social link field.
Available variables:
- links: A collection of social networks links data.
- text: Social link text/icon.
- url: Social network profile link.
- title: Social network name.
- new_tab: Is need to open a new tab.
- appearance: Parameters tha are responsible of appearance.
- orientation: Orientation of links list.
1 theme call to social-link-field-formatter.html.twig
- SocialLinkBaseFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ SocialLinkBaseFormatter.php - Builds a renderable array for a field value.
File
templates/social-link-field-formatter.html.twigView source
- {#
- /**
- * @file
- * Default theme implementation to display a formatted social link field.
- *
- * Available variables:
- * - links: A collection of social networks links data.
- * - text: Social link text/icon.
- * - url: Social network profile link.
- * - title: Social network name.
- * - new_tab: Is need to open a new tab.
- * - appearance: Parameters tha are responsible of appearance.
- * - orientation: Orientation of links list.
- */
- #}
-
- {%
- set classes = [
- 'social-link-field',
- appearance.orientation,
- ]
- %}
-
- {% spaceless %}
- {% if links %}
- <ul {{ attributes.addClass(classes) }}>
- {% for link in links %}
- <li>
- <a href="{{ link.url }}" class="{{ link.class }}" title="{{ link.title }}"{% if new_tab %} target="_blank"{% endif %}>
- {{ link.text }}
- </a>
- </li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endspaceless %}