You are here

links--bootstrap-language-block.html.twig in Bootstrap Languages 8

Default theme implementation for a set of links.

Available variables:

  • attributes: Attributes for the UL containing the list of links.
  • links: Links to be output. Each link will have the following elements:

    • title: The link text.
    • url: The link URL. If omitted, the 'title' is shown as a plain text item in the links list. If 'url' is supplied, the entire link is passed to l() as its $options parameter.
    • attributes: (optional) HTML attributes for the anchor, or for the <span> tag if no 'url' is supplied.
  • languages: languages to be output.

File

templates/links--bootstrap-language-block.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a set of links.
  5. *
  6. * Available variables:
  7. * - attributes: Attributes for the UL containing the list of links.
  8. * - links: Links to be output.
  9. * Each link will have the following elements:
  10. * - title: The link text.
  11. * - url: The link URL. If omitted, the 'title' is shown as a plain text
  12. * item in the links list. If 'url' is supplied, the entire link is passed
  13. * to l() as its $options parameter.
  14. * - attributes: (optional) HTML attributes for the anchor, or for the <span>
  15. * tag if no 'url' is supplied.
  16. * - languages: languages to be output.
  17. *
  18. * @see template_preprocess_links()
  19. * @see bootstrap_languages_preprocess_links__bootstrap_language_block()
  20. *
  21. * @ingroup themeable
  22. */
  23. #}
  24. {% if languages -%}
  25. <div{{ attributes.addClass('btn-group') }}>
  26. <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
  27. <span class="lang-sm" lang="{{ current_language }}"></span>
  28. <span class="caret"></span>
  29. </button>
  30. <ul class="dropdown-menu" role="menu">
  31. {%- for key, url in languages -%}
  32. <li>
  33. <a href="{{ url.toString }}">
  34. <span class="lang-sm lang-lbl" lang="{{ key }}"></span>
  35. </a>
  36. </li>
  37. {%- endfor -%}
  38. </ul>
  39. </div>
  40. {%- endif %}