You are here

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.

File

templates/social-link-field-formatter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display a formatted social link field.
  5. *
  6. * Available variables:
  7. * - links: A collection of social networks links data.
  8. * - text: Social link text/icon.
  9. * - url: Social network profile link.
  10. * - title: Social network name.
  11. * - new_tab: Is need to open a new tab.
  12. * - appearance: Parameters tha are responsible of appearance.
  13. * - orientation: Orientation of links list.
  14. */
  15. #}
  16. {%
  17. set classes = [
  18. 'social-link-field',
  19. appearance.orientation,
  20. ]
  21. %}
  22. {% spaceless %}
  23. {% if links %}
  24. <ul {{ attributes.addClass(classes) }}>
  25. {% for link in links %}
  26. <li>
  27. <a href="{{ link.url }}" class="{{ link.class }}" title="{{ link.title }}"{% if new_tab %} target="_blank"{% endif %}>
  28. {{ link.text }}
  29. </a>
  30. </li>
  31. {% endfor %}
  32. </ul>
  33. {% endif %}
  34. {% endspaceless %}