engelsystem/resources/views/macros/form.twig

23 lines
773 B
Twig
Raw Normal View History

{% macro input(name, label, type, opt) %}
2019-10-08 16:17:06 +02:00
<div class="form-group">
{% if label -%}
2019-10-08 16:17:06 +02:00
<label for="{{ name }}">{{ label }}</label>
{%- endif %}
<input type="{{ type|default('text') }}" class="form-control"
id="{{ name }}" name="{{ name }}"
value="{{ opt.value|default('') }}"
{%- if opt.required|default(false) %}
required="required"
{%- endif -%}
2019-10-08 16:17:06 +02:00
>
</div>
{%- endmacro %}
2019-10-08 16:17:06 +02:00
{% macro hidden(name, value) %}
<input type="hidden" id="{{ name }}" name="{{ name }}" value="{{ value }}">
{%- endmacro %}
2019-10-08 16:17:06 +02:00
{% macro submit(label) %}
<button type="submit" class="btn btn-primary">{{ label|default(__('form.submit')) }}</button>
{%- endmacro %}