mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-07 16:15:22 +02:00
[ticket/17151] Adjust form macros to adhere to coding guidelines
PHPBB3-17151
This commit is contained in:
parent
51d27979ce
commit
d6e3daf291
@ -118,7 +118,9 @@ class forms extends AbstractExtension
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $environment->render('macros/forms/input.twig', [
|
return $environment->render('macros/forms/input.twig', [
|
||||||
|
'CLASS' => (string) ($form_data['class'] ?? ''),
|
||||||
'ID' => (string) ($form_data['id'] ?? ''),
|
'ID' => (string) ($form_data['id'] ?? ''),
|
||||||
|
'DATA' => $form_data['data'] ?? [],
|
||||||
'TYPE' => (string) $form_data['type'],
|
'TYPE' => (string) $form_data['type'],
|
||||||
'NAME' => (string) $form_data['name'],
|
'NAME' => (string) $form_data['name'],
|
||||||
'SIZE' => (int) ($form_data['size'] ?? 0),
|
'SIZE' => (int) ($form_data['size'] ?? 0),
|
||||||
@ -127,9 +129,7 @@ class forms extends AbstractExtension
|
|||||||
'MAX' => (int) ($form_data['max'] ?? 0),
|
'MAX' => (int) ($form_data['max'] ?? 0),
|
||||||
'STEP' => (int) ($form_data['step'] ?? 0),
|
'STEP' => (int) ($form_data['step'] ?? 0),
|
||||||
'CHECKED' => (bool) ($form_data['checked'] ?? false),
|
'CHECKED' => (bool) ($form_data['checked'] ?? false),
|
||||||
'CLASS' => (string) ($form_data['class'] ?? ''),
|
|
||||||
'VALUE' => (string) ($form_data['value']),
|
'VALUE' => (string) ($form_data['value']),
|
||||||
'DATA' => $form_data['data'] ?? [],
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
catch (\Twig\Error\Error $e)
|
catch (\Twig\Error\Error $e)
|
||||||
@ -176,13 +176,13 @@ class forms extends AbstractExtension
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $environment->render('macros/forms/select.twig', [
|
return $environment->render('macros/forms/select.twig', [
|
||||||
'ID' => (string) ($form_data['id'] ?? ''),
|
|
||||||
'CLASS' => (string) ($form_data['class'] ?? ''),
|
'CLASS' => (string) ($form_data['class'] ?? ''),
|
||||||
|
'ID' => (string) ($form_data['id'] ?? ''),
|
||||||
|
'DATA' => $form_data['data'] ?? [],
|
||||||
'NAME' => (string) $form_data['name'],
|
'NAME' => (string) $form_data['name'],
|
||||||
'TOGGLEABLE' => (bool) ($form_data['toggleable'] ?? false),
|
'TOGGLEABLE' => (bool) ($form_data['toggleable'] ?? false),
|
||||||
'OPTIONS' => $form_data['options'] ?? [],
|
'OPTIONS' => $form_data['options'] ?? [],
|
||||||
'GROUP_ONLY' => (bool) ($form_data['group_only'] ?? false),
|
'GROUP_ONLY' => (bool) ($form_data['group_only'] ?? false),
|
||||||
'DATA' => $form_data['data'] ?? [],
|
|
||||||
'SIZE' => (int) ($form_data['size'] ?? 0),
|
'SIZE' => (int) ($form_data['size'] ?? 0),
|
||||||
'MULTIPLE' => (bool) ($form_data['multiple'] ?? false),
|
'MULTIPLE' => (bool) ($form_data['multiple'] ?? false),
|
||||||
]);
|
]);
|
||||||
@ -206,7 +206,9 @@ class forms extends AbstractExtension
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return $environment->render('macros/forms/textarea.twig', [
|
return $environment->render('macros/forms/textarea.twig', [
|
||||||
|
'CLASS' => (string) ($form_data['class'] ?? ''),
|
||||||
'ID' => (string) $form_data['id'],
|
'ID' => (string) $form_data['id'],
|
||||||
|
'DATA' => $form_data['data'] ?? [],
|
||||||
'NAME' => (string) $form_data['name'],
|
'NAME' => (string) $form_data['name'],
|
||||||
'ROWS' => (int) $form_data['rows'],
|
'ROWS' => (int) $form_data['rows'],
|
||||||
'COLS' => (int) $form_data['cols'],
|
'COLS' => (int) $form_data['cols'],
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
{% apply replace({"\n": ' ', "\t": ''}) %}
|
{% apply replace({"\n": ' ', "\t": ''}) %}
|
||||||
<input
|
<input
|
||||||
|
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
||||||
{% if ID %}id="{{ ID }}" {% endif %}
|
{% if ID %}id="{{ ID }}" {% endif %}
|
||||||
|
{% for attribute, attribute_value in DATA %}
|
||||||
|
data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}"
|
||||||
|
{% endfor %}
|
||||||
type="{{ TYPE }}"
|
type="{{ TYPE }}"
|
||||||
name="{{ NAME }}"
|
name="{{ NAME }}"
|
||||||
{% if SIZE %}size="{{ SIZE }}" {% endif %}
|
{% if SIZE %}size="{{ SIZE }}" {% endif %}
|
||||||
@ -10,9 +14,5 @@
|
|||||||
{% if STEP %}step="{{ STEP }}" {% endif %}
|
{% if STEP %}step="{{ STEP }}" {% endif %}
|
||||||
{% if TYPE == 'password' %}autocomplete="off" {% endif %}
|
{% if TYPE == 'password' %}autocomplete="off" {% endif %}
|
||||||
{% if CHECKED %}checked="checked" {% endif %}
|
{% if CHECKED %}checked="checked" {% endif %}
|
||||||
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
|
||||||
{% for attribute, attribute_value in DATA %}
|
|
||||||
data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}"
|
|
||||||
{% endfor %}
|
|
||||||
value="{{ VALUE }}">
|
value="{{ VALUE }}">
|
||||||
{% endapply %}
|
{% endapply %}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
{% apply replace({"\n": ' ', "\t": ''}) %}
|
{% apply replace({"\n": ' ', "\t": ''}) %}
|
||||||
<select
|
<select
|
||||||
{% if ID %}id="{{ ID }}" {% endif %}
|
|
||||||
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
||||||
name="{{ NAME }}"
|
{% if ID %}id="{{ ID }}" {% endif %}
|
||||||
{% if TOGGLEABLE %}data-togglable-settings="true" {% endif %}
|
|
||||||
{% for attribute, attribute_value in DATA %}
|
{% for attribute, attribute_value in DATA %}
|
||||||
data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}"
|
data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
name="{{ NAME }}"
|
||||||
|
{% if TOGGLEABLE %}data-togglable-settings="true" {% endif %}
|
||||||
|
|
||||||
{% if MULTIPLE %}multiple="multiple" {% endif %}
|
{% if MULTIPLE %}multiple="multiple" {% endif %}
|
||||||
{% if SIZE %}size="{{ SIZE }}" {% endif %}>
|
{% if SIZE %}size="{{ SIZE }}" {% endif %}>
|
||||||
{% endapply %}
|
{% endapply %}
|
||||||
@ -14,10 +15,10 @@
|
|||||||
{% if not GROUP_ONLY and element.options %}
|
{% if not GROUP_ONLY and element.options %}
|
||||||
{% apply replace({"\n": ' ', '\t': ''}) %}
|
{% apply replace({"\n": ' ', '\t': ''}) %}
|
||||||
<optgroup
|
<optgroup
|
||||||
label="{{ element.label }}"
|
|
||||||
{% for key, value in element.data %}
|
{% for key, value in element.data %}
|
||||||
data-{{ key }}="{{ value }}"
|
data-{{ key }}="{{ value }}"
|
||||||
{% endfor %}>
|
{% endfor %}
|
||||||
|
label="{{ element.label }}">
|
||||||
{% endapply %}
|
{% endapply %}
|
||||||
{% for option in element.options %}
|
{% for option in element.options %}
|
||||||
<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}{% if option.disabled %} disabled="disabled" class="disabled-option"{% endif %}>{{ option.label }}</option>
|
<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}{% if option.disabled %} disabled="disabled" class="disabled-option"{% endif %}>{{ option.label }}</option>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{% apply replace({"\n": ' ', '\t': ''}) %}
|
{% apply replace({"\n": ' ', '\t': ''}) %}
|
||||||
<textarea
|
<textarea
|
||||||
|
{% if CLASS %}class="{{ CLASS }}" {% endif %}
|
||||||
id="{{ ID }}"
|
id="{{ ID }}"
|
||||||
|
{% for attribute, attribute_value in DATA %}
|
||||||
|
data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}"
|
||||||
|
{% endfor %}
|
||||||
name="{{ NAME }}"
|
name="{{ NAME }}"
|
||||||
rows="{{ ROWS }}"
|
rows="{{ ROWS }}"
|
||||||
cols="{{ COLS }}">
|
cols="{{ COLS }}">{% endapply %}{{ CONTENT }}</textarea>
|
||||||
{{ CONTENT }}
|
|
||||||
</textarea>
|
|
||||||
{% endapply %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user