bs_base-8.x-1.x-dev/templates/form/input--submit.html.twig
templates/form/input--submit.html.twig
{% extends "input.html.twig" %}
{#
/**
* @file
* Theme override for an 'input' #type form element.
*
* Available variables:
* - attributes: A list of HTML attributes for the input element.
* - children: Optional additional rendered elements.
*
* @see template_preprocess_input()
*/
#}
{# Convert core button classes to Bootstrap button classes. #}
{# Check that btn-primary or btn-secondary or btn do not already exist. #}
{% if not attributes.hasClass('btn-primary') and not attributes.hasClass('btn-secondary') and not attributes.hasClass('btn') %}
{% if attributes.hasClass('button--primary') %}
{% set attributes = attributes.addClass('btn-primary') %}
{% elseif attributes.hasClass('button--danger') %}
{% set attributes = attributes.addClass('btn-outline-danger') %}
{% else %}
{# If not primary or danger then default style for button is secondary. #}
{% set attributes = attributes.addClass('btn-secondary') %}
{% endif %}
{% endif %}
{% block input %}
<input{{ attributes.addClass('btn') }} />{{ children }}
{% endblock %}
