You are here

block--secondary-menu--plugin-id--search-form-block.html.twig in Drupal 10

Theme implementation for a search form block in the Secondary Menu region.

Available variables:

  • content: The content of this block.
  • content_attributes: A list of HTML attributes applied to the main content tag that appears in the template.
  • label: The configured label of the block if visible.
  • attributes: HTML attributes for the wrapper.
  • title_attributes: Same as attributes, except applied to the main title tag that appears in the template.
  • title_prefix: Additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
  • title_suffix: Additional output populated by modules, intended to be displayed after the main title tag that appears in the template.

File

core/themes/olivero/templates/block/block--secondary-menu--plugin-id--search-form-block.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme implementation for a search form block in the Secondary Menu region.
  5. *
  6. * Available variables:
  7. * - content: The content of this block.
  8. * - content_attributes: A list of HTML attributes applied to the main content
  9. * tag that appears in the template.
  10. * - label: The configured label of the block if visible.
  11. * - attributes: HTML attributes for the wrapper.
  12. * - title_attributes: Same as attributes, except applied to the main title
  13. * tag that appears in the template.
  14. * - title_prefix: Additional output populated by modules, intended to be
  15. * displayed in front of the main title tag that appears in the template.
  16. * - title_suffix: Additional output populated by modules, intended to be
  17. * displayed after the main title tag that appears in the template.
  18. *
  19. * @see template_preprocess_block()
  20. * @see search_preprocess_block()
  21. *
  22. * @ingroup themeable
  23. */
  24. #}
  25. {%
  26. set classes = [
  27. 'block',
  28. 'block-search-wide',
  29. ]
  30. %}
  31. <div{{ attributes.addClass(classes) }}>
  32. {{ title_prefix }}
  33. {% if label %}
  34. <h2{{ title_attributes }}>{{ label }}</h2>
  35. {% endif %}
  36. {{ title_suffix }}
  37. {% block content %}
  38. <button class="block-search-wide__button" aria-label="{{ 'Search Form'|t }}" data-drupal-selector="block-search-wide-button">
  39. {% include "@olivero/../images/search.svg" %}
  40. <span class="block-search-wide__button-close"></span>
  41. </button>
  42. {#
  43. Add tabindex=“-1” to prevent Safari from closing search bar when the submit button is clicked with a mouse.
  44. @see https://www.drupal.org/project/drupal/issues/3269716
  45. @see https://bugs.webkit.org/show_bug.cgi?id=229895
  46. #}
  47. <div{{ content_attributes.addClass('block-search-wide__wrapper').setAttribute('data-drupal-selector', 'block-search-wide-wrapper').setAttribute('tabindex', '-1') }}>
  48. <div class="block-search-wide__container">
  49. <div class="block-search-wide__grid">
  50. {{ content }}
  51. </div>
  52. </div>
  53. </div>
  54. {% endblock %}
  55. </div>

Related topics