You are here

filter-tips.html.twig in Drupal 10

Theme override for a set of filter tips.

Available variables:

  • tips: Descriptions and a CSS ID in the form of 'module-name/filter-id' (only used when 'long' is TRUE) for each filter in one or more text formats.
  • long: A flag indicating whether the passed-in filter tips contain extended explanations, i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a short format, i.e. suitable to be displayed below a form element. Defaults to FALSE.
  • multiple: A flag indicating there is more than one filter tip.

File

core/themes/bartik/templates/classy/content-edit/filter-tips.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a set of filter tips.
  5. *
  6. * Available variables:
  7. * - tips: Descriptions and a CSS ID in the form of 'module-name/filter-id'
  8. * (only used when 'long' is TRUE) for each filter in one or more text
  9. * formats.
  10. * - long: A flag indicating whether the passed-in filter tips contain extended
  11. * explanations, i.e. intended to be output on the path 'filter/tips'
  12. * (TRUE), or are in a short format, i.e. suitable to be displayed below a
  13. * form element. Defaults to FALSE.
  14. * - multiple: A flag indicating there is more than one filter tip.
  15. *
  16. * @see template_preprocess_filter_tips()
  17. */
  18. #}
  19. {% if multiple %}
  20. <h2>{{ 'Text Formats'|t }}</h2>
  21. {% endif %}
  22. {% if tips|length %}
  23. {% if multiple %}
  24. <div class="compose-tips">
  25. {% endif %}
  26. {% for name, tip in tips %}
  27. {% if multiple %}
  28. {%
  29. set tip_classes = [
  30. 'filter-type',
  31. 'filter-' ~ name|clean_class,
  32. ]
  33. %}
  34. <div{{ tip.attributes.addClass(tip_classes) }}>
  35. <h3>{{ tip.name }}</h3>
  36. {% endif %}
  37. {% if tip.list|length %}
  38. <ul class="tips">
  39. {% for item in tip.list %}
  40. {%
  41. set item_classes = [
  42. long ? 'filter-' ~ item.id|replace({'/': '-'}),
  43. ]
  44. %}
  45. <li{{ item.attributes.addClass(item_classes) }}>{{ item.tip }}</li>
  46. {% endfor %}
  47. </ul>
  48. {% endif %}
  49. {% if multiple %}
  50. </div>
  51. {% endif %}
  52. {% endfor %}
  53. {% if multiple %}
  54. </div>
  55. {% endif %}
  56. {% endif %}