You are here

input--button.html.twig in Open Social 8.9

Theme suggestion for "button" input form element.

Available variables:

  • attributes: A list of HTML attributes for the input element.
  • children: Optional additional rendered elements.
  • icon: An icon.
  • icon_only: Flag to display only the icon and not the label.
  • icon_position: Where an icon should be displayed.
  • label: button label.
  • prefix: Markup to display before the input element.
  • suffix: Markup to display after the input element.
  • type: The type of input.

File

themes/socialbase/templates/form/input--button.html.twig
View source
  1. {% extends "input.html.twig" %}
  2. {#
  3. /**
  4. * @file
  5. * Theme suggestion for "button" input form element.
  6. *
  7. * Available variables:
  8. * - attributes: A list of HTML attributes for the input element.
  9. * - children: Optional additional rendered elements.
  10. * - icon: An icon.
  11. * - icon_only: Flag to display only the icon and not the label.
  12. * - icon_position: Where an icon should be displayed.
  13. * - label: button label.
  14. * - prefix: Markup to display before the input element.
  15. * - suffix: Markup to display after the input element.
  16. * - type: The type of input.
  17. *
  18. * @see \Drupal\bootstrap\Plugin\Preprocess\InputButton
  19. * @see \Drupal\bootstrap\Plugin\Preprocess\Input
  20. * @see template_preprocess_input()
  21. *
  22. * @ingroup templates
  23. */
  24. #}
  25. {% spaceless %}
  26. {% block input %}
  27. {% if icon_only %}
  28. <button{{ attributes.addClass(classes, 'icon-only') }}>
  29. <span class="sr-only">{{ label }}</span>
  30. {{ icon }}
  31. </button>
  32. {% else %}
  33. {% if icon_position == 'after' %}
  34. <button{{ attributes.addClass(classes) }}>{{ label }}{{ icon }}{{ element.caret }}</button>{{ children }}
  35. {% else %}
  36. <button{{ attributes.addClass(classes) }}>{{ icon }}{{ label }}{{ element.caret }}</button>{{ children }}
  37. {% endif %}
  38. {% endif %}
  39. {% if addsearchicon %}
  40. <span class="search-icon">
  41. <svg>
  42. <use xlink:href="#icon-search"></use>
  43. </svg>
  44. </span>
  45. {% endif %}
  46. {{ children }}
  47. {% endblock %}
  48. {% endspaceless %}