diff --git a/phpBB/adm/style/form_macros.twig b/phpBB/adm/style/form_macros.twig index a0cba50855..124f066093 100644 --- a/phpBB/adm/style/form_macros.twig +++ b/phpBB/adm/style/form_macros.twig @@ -37,7 +37,7 @@ {% endmacro %} {% macro select(form_data) %} - {% for option in form_data.options %} {% endfor %} @@ -51,6 +51,10 @@ {{ _self.dimension(form_data) }} {% elseif form_data.tag == 'radio' %} {{ _self.radio_buttons(form_data) }} + {% elseif form_data.tag == 'select' %} + {{ _self.select(form_data) }} + {% elseif form_data.tag == 'textarea' %} + {{ _self.textarea(form_data) }} {% elseif form_data[0] %} {% for element in form_data %} {{ _self.build_template(element) }} diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 8c3950d65c..18fccae5a5 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -64,7 +64,7 @@ class acp_board 'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), 'board_disable_msg' => false, - 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), + 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'method' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), @@ -976,19 +976,52 @@ class acp_board /** * Select bump interval */ - function bump_interval($value, $key) + public function bump_interval($value, $key): array { - global $user; + global $language; - $s_bump_type = ''; + $bump_type_options = []; $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); foreach ($types as $type => $lang) { - $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; - $s_bump_type .= ''; + $bump_type_options[] = [ + 'value' => $type, + 'selected' => $this->new_config['bump_type'] == $type, + 'label' => $language->lang($lang), + ]; } - return ' '; + return [ + [ + 'tag' => 'input', + 'id' => $key, + 'type' => 'text', + 'size' => 3, + 'maxlength' => 4, + 'name' => 'config[bump_interval]', + 'value' => $value, + ], + [ + 'tag' => 'select', + 'name' => 'config[bump_type]', + 'options' => $bump_type_options, + ], + ]; + } + + /** + * Wrapper function for phpbb_language_select() + * + * @param string $default + * @param array $langdata + * + * @return array + */ + public function language_select(string $default = '', array $langdata = []): array + { + global $db; + + return phpbb_language_select($db, $default, $langdata); } /** diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index b6c9c7b39d..106ca8bf66 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -482,10 +482,23 @@ function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars) if ($tpl_type[0] == 'select') { - $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; - $data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : ''; + if (is_string($return)) + { + $size = (isset($tpl_type[1])) ? (int)$tpl_type[1] : 1; + $data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : ''; - $tpl = ''; + $tpl = ''; + } + else + { + $tpl = [ + 'tag' => 'select', + 'id' => $key, + 'name' => $name, + 'toggleable' => !empty($tpl_type[2]), + 'options' => $return, + ]; + } } else {