diff --git a/resources/views/macros/form.twig b/resources/views/macros/form.twig
index 446edc6a..d776db02 100644
--- a/resources/views/macros/form.twig
+++ b/resources/views/macros/form.twig
@@ -6,12 +6,36 @@
{%- endmacro %}
-{% macro input(name, label, type, opt) %}
+{#
+Renders an input field wrapped in a DIV with mb-3.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} label - If not empty a "label" element with this text will be rendered.
+@param {string} [opt.type="text"] - Optional type of the input field. Defaults to "text".
+@param {bool} [opt.hide_label=false] - If true the label will be hidden. This could be useful for screenreders.
+ Defaults to false.
+@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label
+ to indicate that this field is mandatory.
+ Won't be displayed without a label. Defaults to false.
+@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip.
+ Won't be displayed without a label.
+@param {string} [opt.value=""] - Optional value to set. Defaults to empty string.
+@param {int} [opt.min_length] - Optional "minlength" attribute value.
+@param {int} [opt.max_length] - Optional "maxlength" attribute value.
+@param {int|float|string} [opt.min] - Optional "min" attribute value.
+@param {int|float|string} [opt.max] - Optional "max" attribute value.
+@param {int|float} [opt.step] - Optional "step" attribute value.
+@param {string} [opt.autocomplete] - Optional "autocomplete" attribute value.
+@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false.
+@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false.
+@param {bool} [opt.readonly=false] - Whether to add the "readonly" attribute. Defaults to false.
+#}
+{% macro input(name, label, opt) %}
{% if label -%}
{%- endif %}
{%- endmacro %}
+{#
+Renders a "number" type input field wrapped in a DIV with mb-3.
+Also adds buttons to increment / decrement the value.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} label - If not empty a "label" element with this text will be rendered.
+@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label
+ to indicate that this field is mandatory.
+ Won't be displayed without a label. Defaults to false.
+@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip.
+ Won't be displayed without a label.
+@param {string} [opt.value=""] - Optional value to set. Defaults to empty string.
+@param {int|float|string} [opt.min] - Optional "min" attribute value.
+@param {int|float|string} [opt.max] - Optional "max" attribute value.
+@param {int|float} [opt.step] - Optional "step" attribute value.
+@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false.
+@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false.
+@param {bool} [opt.readonly=false] - Whether to add the "readonly" attribute. Defaults to false.
+#}
{% macro number(name, label, opt) %}
- {% if label -%}
+ {% if label is defined -%}
- {% if opt.entry_required_icon|default(false) %}
+ {% if opt.required_icon|default(false) %}
{{ _self.entry_required() }}
{% endif %}
{% if opt.info is defined %}
@@ -84,11 +127,24 @@
{% endmacro %}
+{#
+Renders a "textarea" element wrapped in a DIV with mb-3.
+Also adds buttons to increment / decrement the value.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} label - If not empty a "label" element with this text will be rendered.
+@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label
+ to indicate that this field is mandatory.
+ Won't be displayed without a label. Defaults to false.
+@param {bool} [opt.required] - Whether to add the "required" attribute. Defaults to false.
+@param {int} [opt.rows=0] - Optional value of the "rows" attriute. Defaults to 0.
+@param {string} [opt.value=""] - Optional value to set. Defaults to empty string.
+#}
{% macro textarea(name, label, opt) %}
- {% if label -%}
+ {% if label is defined -%}
- {% if opt.entry_required_icon|default(false) %}
+ {% if opt.required_icon|default(false) %}
{{ _self.entry_required() }}
{% endif %}
{% if opt.info is defined %}
@@ -106,12 +162,28 @@
{%- endmacro %}
-{% macro select(name, data, label, selected, opt) %}
+{#
+Renders a select element wrapped in a DIV with mb-3.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} label - If not empty a "label" element with this text will be rendered.
+@param {{value, description}} data - Select options. "value" will be the option value, "description" the label.
+@param {string} [opt.selected] - Optional value of an option to initially set as "selected".
+@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label
+ to indicate that this field is mandatory.
+ Won't be displayed without a label. Defaults to false.
+@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip.
+ Won't be displayed without a label.
+@param {string} [opt.class] - Optional additional CSS classes to be added to the actual "select" element.
+@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false.
+@param {bool} [opt.default_option] - If set a default option with the param as label and an empty value will be added.
+#}
+{% macro select(name, label, data, opt) %}
- {% if label -%}
+ {% if label is defined -%}
{%- endmacro %}
-{% macro checkbox(name, label, checked, value, disabled, raw_label, opt) %}
+{#
+Renders a Bootstrap checkbox element with mb-3.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} label - Checkbox label
+@param {string} [opt.value="1"] - Optional value to set. Defaults to "1".
+@param {bool} [opt.checked=false] - Whether to add the "checked" attribute. Defaults to false.
+@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false.
+@param {bool} [opt.raw_label=false] - Whether to use the raw label value (=do not escape). Defaults to false.
+@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip.
+#}
+{% macro checkbox(name, label, opt) %}
{%- endmacro %}
+{#
+Renders a "hidden" type input field.
+
+@param {string} name - Will be used as value for "id" and "name" attributes.
+@param {string} value - Field value
+#}
{% macro hidden(name, value) %}
{%- endmacro %}
+{#
+Renders a button.
+
+@param {string} label - Button label
+@param {string} [opt.btn_type="secondary"] - Bootstrap button type. Defaults to "secondary".
+@param {string} [opt.size] - Optional Bootstrap button size to apply, such as "sm", "lg".
+@param {string} [opt.type] - Optional value for the "type" attribute.
+@param {string} [opt.name] - Optional value for the "name" attribute.
+@param {string} [opt.title] - Optional value for the "title" attribute.
+@param {string} [opt.value] - Optional value for the "value" attribute.
+ Defaults to "1" if only opt.name is provided.
+@param {string} [opt.icon_left] - Optional icon to be added before the button label.
+ Must be a Bootstrap icon class without prefix, such as "info" or "check".
+@param {string} [opt.icon_right] - Optional icon to be added after the button label.
+ Must be a Bootstrap icon class without prefix, such as "info" or "check".
+#}
{% macro button(label, opt) %}