1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/17100] Move build_cfg_template parts to HTML-less function

PHPBB3-17100
This commit is contained in:
Marc Alexander
2022-04-18 11:31:23 +02:00
parent f64eb7dd04
commit 99368ab19a
4 changed files with 207 additions and 23 deletions

View File

@@ -37,6 +37,7 @@
<!-- IF S_ATTACHMENT_SETTINGS -->
{% import "form_macros.twig" as form_macros %}
<form id="attachsettings" method="post" action="{U_ACTION}">
<!-- BEGIN options -->
<!-- IF options.S_LEGEND -->
@@ -49,7 +50,20 @@
<dl>
<dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
<dd>{options.CONTENT}</dd>
<dd>
{% if options.CONTENT.tag %}
{% if options.CONTENT.tag == 'input' %}
{{ form_macros.input(options.CONTENT) }}
{% elseif options.CONTENT.tag == 'dimension' %}
{{ form_macros.dimension(options.CONTENT) }}
{% elseif options.CONTENT.tag == 'radio' %}
{{ form_macros.radio_buttons(options.CONTENT) }}
{% endif %}
{% if options.CONTENT.append %}{{ options.CONTENT.append }}{% endif %}
{% else %}
{options.CONTENT}
{% endif %}
</dd>
{% if (options.KEY == 'allow_attachments' and S_EMPTY_POST_GROUPS) or (options.KEY == 'allow_pm_attach' and S_EMPTY_PM_GROUPS) %}
<dd><span class="error">{{ lang(options.KEY == 'allow_attachments' ? 'NO_EXT_GROUP_ALLOWED_POST' : 'NO_EXT_GROUP_ALLOWED_PM', U_EXTENSION_GROUPS) }}</span></dd>
{% endif %}

View File

@@ -13,6 +13,7 @@
</div>
<!-- ENDIF -->
{% import "form_macros.twig" as form_macros %}
<form id="acp_board" method="post" action="{U_ACTION}">
<!-- BEGIN options -->
@@ -27,7 +28,20 @@
<dl>
<dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
<dd>{options.CONTENT}</dd>
<dd>
{% if options.CONTENT.tag %}
{% if options.CONTENT.tag == 'input' %}
{{ form_macros.input(options.CONTENT) }}
{% elseif options.CONTENT.tag == 'dimension' %}
{{ form_macros.dimension(options.CONTENT) }}
{% elseif options.CONTENT.tag == 'radio' %}
{{ form_macros.radio_buttons(options.CONTENT) }}
{% endif %}
{% if options.CONTENT.append %}{{ options.CONTENT.append }}{% endif %}
{% else %}
{{ options.CONTENT }}
{% endif %}
</dd>
</dl>
<!-- ENDIF -->

View File

@@ -0,0 +1,35 @@
{% macro input(form_data) %}
<input
{% if form_data.id %}id="{{ form_data.id }}"{% endif %}
type="{{ form_data.type }}"
name="{{ form_data.name }}"
{% if form_data.size %}size="{{ form_data.size }}"{% endif %}
{% if form_data.maxlength %}maxlength="{{ form_data.maxlength }}"{% endif %}
{% if form_data.min %}min="{{ form_data.min }}"{% endif %}
{% if form_data.max %}max="{{ form_data.max }}"{% endif %}
{% if form_data.type == 'password' %}autocomplete="off"{% endif %}
{% if form_data.checked %}checked="checked"{% endif %}
{% if form_data.class %}class="{{ form_data.class }}"{% endif %}
value="{{ form_data.value }}"
>
{% endmacro %}
{% macro dimension(form_data) %}
{{ _self.input(form_data.width) }} x {{ _self.input(form_data.height) }}
{% endmacro %}
{% macro textarea(form_data) %}
<textarea
id="{{ form_data.id }}"
name="{{ form_data.name }}"
rows="{{ form_data.rows }}"
cols="{{ form_data.cols }}"
>
{{ form_data.content }}
</textarea>
{% endmacro %}
{% macro radio_buttons(form_data) %}
<label>{{ _self.input(form_data.buttons[0]) ~ form_data.buttons[0].label }}</label>
<label>{{ _self.input(form_data.buttons[1]) ~ form_data.buttons[1].label }}</label>
{% endmacro %}