You are here

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

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 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 }}</button>{{ children }}
  35. {% else %}
  36. <button{{ attributes.addClass(classes) }}>{{ icon }}{{ label }}</button>{{ children }}
  37. {% endif %}
  38. {% endif %}
  39. {%
  40. set classes = [
  41. 'btn',
  42. theme.settings.button_size ? theme.settings.button_size,
  43. 'dropdown-toggle',
  44. button_type == 'default' ? 'btn-default',
  45. button_type == 'flat' ? 'btn-flat',
  46. button_type == 'primary' ? 'btn-primary',
  47. button_level == 'raised' ? 'btn-raised',
  48. ]
  49. %}
  50. <button{{ split_button_attributes.addClass(classes) }} type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  51. <span class="caret"></span>
  52. <span class="sr-only">{{ 'Toggle Dropdown'|t }}</span>
  53. </button>
  54. {{ children }}
  55. {% endblock %}
  56. {% endspaceless %}