mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 03:34:04 +02:00
[ticket/17100] Use twig functions for form elements
PHPBB3-17100
This commit is contained in:
16
phpBB/styles/all/template/macros/forms/build_template.twig
Normal file
16
phpBB/styles/all/template/macros/forms/build_template.twig
Normal file
@@ -0,0 +1,16 @@
|
||||
{% if form_data.tag == 'input' %}
|
||||
{{ FormsInput(form_data) }}
|
||||
{% elseif form_data.tag == 'dimension' %}
|
||||
{{ FormsDimension(form_data) }}
|
||||
{% elseif form_data.tag == 'radio' %}
|
||||
{{ FormsRadioButtons(form_data) }}
|
||||
{% elseif form_data.tag == 'select' %}
|
||||
{{ FormsSelect(form_data) }}
|
||||
{% elseif form_data.tag == 'textarea' %}
|
||||
{{ FormsTextarea(form_data) }}
|
||||
{% elseif form_data[0] %}
|
||||
{% for element in form_data %}
|
||||
{{ FormsBuildTemplate(element) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if form_data.append %}{{ form_data.append }}{% endif %}
|
1
phpBB/styles/all/template/macros/forms/dimension.twig
Normal file
1
phpBB/styles/all/template/macros/forms/dimension.twig
Normal file
@@ -0,0 +1 @@
|
||||
{{ FormsInput(WIDTH) }} x {{ FormsInput(HEIGHT) }}
|
15
phpBB/styles/all/template/macros/forms/input.twig
Normal file
15
phpBB/styles/all/template/macros/forms/input.twig
Normal file
@@ -0,0 +1,15 @@
|
||||
{% apply replace({"\n": ' ', "\t": ''}) %}
|
||||
<input
|
||||
{% if ID %}id="{{ ID }}" {% endif %}
|
||||
type="{{ TYPE }}"
|
||||
name="{{ NAME }}"
|
||||
{% if SIZE %}size="{{ SIZE }}" {% endif %}
|
||||
{% if MAXLENGTH %}maxlength="{{ MAXLENGTH }}" {% endif %}
|
||||
{% if MIN %}min="{{ MIN }}" {% endif %}
|
||||
{% if MAX %}max="{{ MAX }}" {% endif %}
|
||||
{% if STEP %}step="{{ STEP }}" {% endif %}
|
||||
{% if TYPE == 'password' %}autocomplete="off" {% endif %}
|
||||
{% if CHECKED %}checked="checked" {% endif %}
|
||||
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
||||
value="{{ VALUE }}">
|
||||
{% endapply %}
|
@@ -0,0 +1,2 @@
|
||||
<label>{{ FormsInput(FIRST_BUTTON) ~ FIRST_BUTTON_LABEL }}</label>
|
||||
<label>{{ FormsInput(SECOND_BUTTON) ~ SECOND_BUTTON_LABEL }}</label>
|
26
phpBB/styles/all/template/macros/forms/select.twig
Normal file
26
phpBB/styles/all/template/macros/forms/select.twig
Normal file
@@ -0,0 +1,26 @@
|
||||
{% apply replace({"\n": ' ', "\t": ''}) %}
|
||||
<select
|
||||
{% if ID %}id="{{ ID }}" {% endif %}
|
||||
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
||||
name="{{ NAME }}"
|
||||
{% if TOGGLEABLE %}data-togglable-settings="true" {% endif %}
|
||||
{% if SIZE %}size="{{ SIZE }}" {% endif %}>
|
||||
{% endapply %}
|
||||
{% for element in OPTIONS %}
|
||||
{% if not GROUP_ONLY and element.options %}
|
||||
{% apply replace({"\n": ' ', '\t': ''}) %}
|
||||
<optgroup
|
||||
label="{{ element.label }}"
|
||||
{% for key, value in element.data %}
|
||||
data-{{ key }}="{{ value }}"
|
||||
{% endfor %}>
|
||||
{% endapply %}
|
||||
{% for option in element.options %}
|
||||
<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}>{{ option.label }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% else %}
|
||||
<option value="{{ element.value }}"{% if element.selected %} selected="selected"{% endif %}>{{ element.label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
9
phpBB/styles/all/template/macros/forms/textarea.twig
Normal file
9
phpBB/styles/all/template/macros/forms/textarea.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
{% apply replace({"\n": ' ', '\t': ''}) %}
|
||||
<textarea
|
||||
id="{{ ID }}"
|
||||
name="{{ NAME }}"
|
||||
rows="{{ ROWS }}"
|
||||
cols="{{ COLS }}">
|
||||
{{ CONTENT }}
|
||||
</textarea>
|
||||
{% endapply %}
|
Reference in New Issue
Block a user