mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/17100] Refactor code to be more reusable
PHPBB3-17100
This commit is contained in:
@@ -51,15 +51,8 @@
|
||||
<dl>
|
||||
<dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
|
||||
<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 %}
|
||||
{% if options.CONTENT is iterable %}
|
||||
{{ form_macros.build_template(options.CONTENT)}}
|
||||
{% else %}
|
||||
{options.CONTENT}
|
||||
{% endif %}
|
||||
|
@@ -29,15 +29,8 @@
|
||||
<dl>
|
||||
<dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
|
||||
<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 %}
|
||||
{% if options.CONTENT is iterable %}
|
||||
{{ form_macros.build_template(options.CONTENT)}}
|
||||
{% else %}
|
||||
{{ options.CONTENT }}
|
||||
{% endif %}
|
||||
|
@@ -30,13 +30,10 @@
|
||||
<dd><select id="bot_style" name="bot_style">{S_STYLE_OPTIONS}</select></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="bot_lang">{L_BOT_LANG}{L_COLON}</label><br /><span>{L_BOT_LANG_EXPLAIN}</span></dt>
|
||||
<dt><label for="{{ LANG_OPTIONS.id }}">{L_BOT_LANG}{L_COLON}</label><br /><span>{L_BOT_LANG_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<select id="bot_lang" name="bot_lang">
|
||||
{% for option in lang_options %}
|
||||
<option value="{{ option.LANG_ISO }}"{% if option.SELECTED %} selected="selected"{% endif %}>{{ option.LANG_LOCAL_NAME }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% import "form_macros.twig" as form_macros %}
|
||||
{{ form_macros.select(LANG_OPTIONS) }}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
|
@@ -41,13 +41,10 @@
|
||||
<label><input type="radio" class="radio" name="notifypm" value="0"<!-- IF not NOTIFY_PM --> id="notifypm" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="lang">{L_BOARD_LANGUAGE}{L_COLON}</label></dt>
|
||||
<dt><label for="{{ LANG_OPTIONS.id }}">{L_BOARD_LANGUAGE}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<select id="lang" name="lang">
|
||||
{% for option in lang_options %}
|
||||
<option value="{{ option.LANG_ISO }}"{% if option.SELECTED %} selected="selected"{% endif %}>{{ option.LANG_LOCAL_NAME }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% import "form_macros.twig" as form_macros %}
|
||||
{{ form_macros.select(LANG_OPTIONS) }}
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
|
@@ -33,3 +33,26 @@
|
||||
<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 %}
|
||||
|
||||
{% macro select(form_data) %}
|
||||
<select id="{{ form_data.id }}" name="{{ form_data.name }}">
|
||||
{% for option in form_data.options %}
|
||||
<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}>{{ option.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro build_template(form_data) %}
|
||||
{% if form_data.tag == 'input' %}
|
||||
{{ _self.input(form_data) }}
|
||||
{% elseif form_data.tag == 'dimension' %}
|
||||
{{ _self.dimension(form_data) }}
|
||||
{% elseif form_data.tag == 'radio' %}
|
||||
{{ _self.radio_buttons(form_data) }}
|
||||
{% elseif form_data[0] %}
|
||||
{% for element in form_data %}
|
||||
{{ _self.build_template(element) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if form_data.append %}{{ form_data.append }}{% endif %}
|
||||
{% endmacro %}
|
||||
|
Reference in New Issue
Block a user