You are here

input.html.twig in Open Social 8.2

Default theme implementation for an 'input' #type form element.

Available variables:

  • attributes: A list of HTML attributes for the input element.
  • children: Optional additional rendered elements.
  • icon: An icon.
  • input_group: Flag to display as an input group.
  • icon_position: Where an icon should be displayed.
  • 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.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for an 'input' #type form element.
  5. *
  6. * Available variables:
  7. * - attributes: A list of HTML attributes for the input element.
  8. * - children: Optional additional rendered elements.
  9. * - icon: An icon.
  10. * - input_group: Flag to display as an input group.
  11. * - icon_position: Where an icon should be displayed.
  12. * - prefix: Markup to display before the input element.
  13. * - suffix: Markup to display after the input element.
  14. * - type: The type of input.
  15. *
  16. * @see \Drupal\bootstrap\Plugin\Preprocess\Input
  17. * @see template_preprocess_input()
  18. *
  19. * @ingroup templates
  20. */
  21. #}
  22. {%
  23. set classes = [
  24. type != 'submit' and type != 'button' ? 'form-control',
  25. type == 'button' ? 'btn',
  26. type == 'submit' ? 'btn js-form-submit',
  27. float_right ? 'pull-right',
  28. button_level == 'raised' ? 'btn-raised',
  29. button_type == 'default' ? 'btn-default',
  30. button_type == 'flat' ? 'btn-flat',
  31. button_type == 'primary' ? 'btn-primary',
  32. button_type == 'accent' ? 'btn-accent',
  33. button_size == 'small' ? 'btn-sm',
  34. attributes.hasClass('crop-preview-wrapper__crop-reset') ? 'btn-flat',
  35. icon and icon_position and not icon_only ? 'icon-' ~ icon_position,
  36. ]
  37. %}
  38. {% spaceless %}
  39. {% if input_group %}
  40. {{ attach_library('socialbase/form--input-groups') }}
  41. <div class="input-group">
  42. {% endif %}
  43. {% if prefix %}
  44. {{ prefix }}
  45. {% endif %}
  46. {% block input %}
  47. <input{{ attributes.addClass(classes) }} />
  48. {% endblock %}
  49. {% if suffix %}
  50. {{ suffix }}
  51. {% endif %}
  52. {% if input_group %}
  53. </div>
  54. {% endif %}
  55. {{ children }}
  56. {% endspaceless %}