socialbase-1.1.0/templates/form/input.html.twig
templates/form/input.html.twig
{#
/**
* @file
* 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.
*
* @see \Drupal\bootstrap\Plugin\Preprocess\Input
* @see template_preprocess_input()
*
* @ingroup templates
*/
#}
{%
set classes = [
type != 'submit' and type != 'button' ? 'form-control',
type == 'button' ? 'btn',
type == 'submit' ? 'btn js-form-submit',
float_right ? 'pull-right',
button_level == 'raised' ? 'btn-raised',
button_type == 'default' ? 'btn-default',
button_type == 'flat' ? 'btn-flat',
button_type == 'primary' ? 'btn-primary',
button_type == 'accent' ? 'btn-accent',
button_size == 'small' ? 'btn-sm',
attributes.hasClass('crop-preview-wrapper__crop-reset') ? 'btn-flat',
icon and icon_position and not icon_only ? 'icon-' ~ icon_position,
]
%}
{% apply spaceless %}
{% if input_group %}
{{ attach_library('socialbase/form--input-groups') }}
<div class="input-group">
{% endif %}
{% if prefix %}
{{ prefix }}
{% endif %}
{% block input %}
{% if simple_checkbox %}
<input{{ attributes }} />
{% else %}
<input{{ attributes.addClass(classes) }} />
{% endif %}
{% endblock %}
{% if suffix %}
{{ suffix }}
{% endif %}
{% if input_group %}
</div>
{% endif %}
{{ children }}
{% endapply %}
