You are here

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

Theme suggestion for "button__split" 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--split.html.twig
View source
  1. {% extends "input--button.html.twig" %}
  2. {#
  3. /**
  4. * @file
  5. * Theme suggestion for "button__split" 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 default_button %}
  28. {% if icon_only %}
  29. <button{{ attributes.addClass(classes, 'icon-only') }}>
  30. <span class="sr-only">{{ label }}</span>
  31. {{ icon }}
  32. </button>
  33. {% else %}
  34. {% if icon_position == 'after' %}
  35. <button{{ attributes.addClass(classes) }}>{{ label }}{{ icon }}</button>{{ children }}
  36. {% else %}
  37. <button{{ attributes.addClass(classes) }}>{{ icon }}{{ label }}</button>{{ children }}
  38. {% endif %}
  39. {% endif %}
  40. {% endif %}
  41. {%
  42. set classes = [
  43. 'btn',
  44. theme.settings.button_size ? theme.settings.button_size,
  45. 'dropdown-toggle',
  46. button_type == 'default' ? 'btn-default',
  47. button_type == 'flat' ? 'btn-flat',
  48. button_type == 'primary' ? 'btn-primary',
  49. button_level == 'raised' ? 'btn-raised',
  50. ]
  51. %}
  52. <button{{ split_button_attributes.addClass(classes) }} type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  53. {% if not default_button %}
  54. {{ label }}
  55. {% endif %}
  56. <span class="caret"></span>
  57. <span class="sr-only">{{ 'Toggle Dropdown'|t }}</span>
  58. </button>
  59. {{ children }}
  60. {% endblock %}
  61. {% endspaceless %}