block--system-menu-block.html.twig 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a menu block.
  5. *
  6. * Available variables:
  7. * - plugin_id: The ID of the block implementation.
  8. * - label: The configured label of the block if visible.
  9. * - configuration: A list of the block's configuration values.
  10. * - label: The configured label for the block.
  11. * - label_display: The display settings for the label.
  12. * - provider: The module or other provider that provided this block plugin.
  13. * - Block plugin specific settings will also be stored here.
  14. * - content: The content of this block.
  15. * - attributes: HTML attributes for the containing element.
  16. * - id: A valid HTML ID and guaranteed unique.
  17. * - title_attributes: HTML attributes for the title element.
  18. * - content_attributes: HTML attributes for the content element.
  19. * - title_prefix: Additional output populated by modules, intended to be
  20. * displayed in front of the main title tag that appears in the template.
  21. * - title_suffix: Additional output populated by modules, intended to be
  22. * displayed after the main title tag that appears in the template.
  23. *
  24. * Headings should be used on navigation menus that consistently appear on
  25. * multiple pages. When this menu block's label is configured to not be
  26. * displayed, it is automatically made invisible using the 'visually-hidden' CSS
  27. * class, which still keeps it visible for screen-readers and assistive
  28. * technology. Headings allow screen-reader and keyboard only users to navigate
  29. * to or skip the links.
  30. * See http://juicystudio.com/article/screen-readers-display-none.php and
  31. * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
  32. *
  33. * @ingroup themeable
  34. */
  35. #}
  36. {% set heading_id = attributes.id ~ '-menu'|clean_id %}
  37. <nav role="navigation" aria-labelledby="{{ heading_id }}"{{ attributes|without('role', 'aria-labelledby') }}>
  38. {# Label. If not displayed, we still provide it for screen readers. #}
  39. {% if not configuration.label_display %}
  40. {% set title_attributes = title_attributes.addClass('visually-hidden') %}
  41. {% endif %}
  42. {{ title_prefix }}
  43. <h2{{ title_attributes.setAttribute('id', heading_id) }}>{{ configuration.label }}</h2>
  44. {{ title_suffix }}
  45. {# Menu. #}
  46. {% block content %}
  47. {{ content }}
  48. {% endblock %}
  49. </nav>