Twig: Macros: Form: Use input options and primary submit button
parent
89742ecd55
commit
377b390c97
@ -1,18 +1,22 @@
|
|||||||
{% macro input(name, label, type, required) %}
|
{% macro input(name, label, type, opt) %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{% if label %}
|
{% if label -%}
|
||||||
<label for="{{ name }}">{{ label }}</label>
|
<label for="{{ name }}">{{ label }}</label>
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
<input type="{{ type|default('text') }}" class="form-control" id="{{ name }}" name="{{ name }}"
|
<input type="{{ type|default('text') }}" class="form-control"
|
||||||
{%- if required|default(false) %} required="required"{% endif -%}
|
id="{{ name }}" name="{{ name }}"
|
||||||
|
value="{{ opt.value|default('') }}"
|
||||||
|
{%- if opt.required|default(false) %}
|
||||||
|
required="required"
|
||||||
|
{%- endif -%}
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro hidden(name, value) %}
|
{% macro hidden(name, value) %}
|
||||||
<input type="hidden" id="{{ name }}" name="{{ name }}" value="{{ value }}">
|
<input type="hidden" id="{{ name }}" name="{{ name }}" value="{{ value }}">
|
||||||
{% endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro submit(label) %}
|
{% macro submit(label) %}
|
||||||
<button type="submit" class="btn btn-default">{{ label|default(__('form.submit')) }}</button>
|
<button type="submit" class="btn btn-primary">{{ label|default(__('form.submit')) }}</button>
|
||||||
{% endmacro %}
|
{%- endmacro %}
|
||||||
|
Loading…
Reference in New Issue