{% use "form_div_layout.html.twig" %}
{#
Archivo para generar la configuración de botones de cada página...
Ejemplo:
{% set header_buttons = [
{
* 'show' : is_granted('ROLE_MEZCLAS_CREATE'), //OBLIGATORIO - Condicion a seguir (true o false)
'title' : {
'text' : '' //Texto de titulo de la página para el objeto visualizado
'class' : ''
}
'tag' : 'a', //Elemento a crear [a, button], si no se especifica se utiliza 'a'
'icon' : 'far fa-plus-square', //Icono a utilizar
'text_xs_pre' : 'string', //Texto visible en todos los tamaños antes del otro tamaño
'text_sm_pre' : 'string', //Texto visible hasta el tamaño SM antes del otro tamaño
'text_md_in' : 'string', //Texto visible hasta el tamaño MD
'text_sm_post' : 'string', //Texto visible hasta el tamaño SM despues del anterior
'text_xs_post' : 'string', //Texto visible en todos los tamaños despues del anterior
'attr' : { //Todos los atributos que queramos añadir al elemento...
'class' : 'btn-danger',
'href' : path('mezcla_new')
}
}
] %}
#}
{% if header_buttons is defined and header_buttons is iterable %}
{% if app.session.get('back_button_route') %}
<a href="{{ path(app.session.get('back_button_route'), app.session.get('back_button_params') | default({}) | merge({'back_clear' : 1})) }}" role="button" class="btn btn-sm btn-secondary btn-with-addon text-nowrap me-1">
<span class="btn-addon">
<i class="btn-addon-icon fas fa-undo-alt"></i>
</span>
{{ app.session.get('back_button_text') }}
</a>
{% endif %}
{% for but in header_buttons %}
{% set continue = true %}
{% if app.session.get('back_button_route') and (but.id is defined ? but.id == "returnListButton") %}
{% set continue = false %}
{% endif %}
{% if (but.show | default(false)) and continue %}
{% set attr = but.attr | default({}) | merge( { class: (but.attr.class|default('') ~ ' btn btn-sm text-nowrap me-1 ' ~ (but.icon is defined ? 'px-3 btn-with-addon' : '')) | trim} ) %}
<{{ but.tag | default('a') }} {{ block('attributes') }}>
{% if but.icon is defined %}
<span class="btn-addon">
<i class="btn-addon-icon {{ but.icon }}"></i>
</span>
{% endif %}
{{ but.text_xs_pre | default('') }}
<span class="d-none d-sm-inline">
{{ but.text_sm_pre | default('') }}
<span class="d-none d-md-inline">{{ but.text_md_in | default('') }}</span>
<span class="d-none d-xl-inline">{{ but.text_xl_in | default('') }}</span>
{{ but.text_sm_post | default('') }}
</span>
{{ but.text_xs_post | default('') }}
</{{ but.tag | default('a') }}>
{% endif %}
{% endfor %}
{% endif %}
{#{{ include(PATH_PARTIALS ~ '/_topbar_filtro.html.twig')}}#}