diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 84254744c4..f60037cec5 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -1120,6 +1120,8 @@ class acp_board * * @param string $value Current date format value * @param string $key Date format key + * + * @return array Date format select data */ public function dateformat_select(string $value, string $key): array { @@ -1184,40 +1186,62 @@ class acp_board } /** - * Select multiple forums - */ - function select_news_forums($value, $key) + * Select for multiple forums + * + * @param mixed $value Config value, unused + * @param string $key Config key + * + * @return array Forum select data + */ + public function select_news_forums($value, string $key) { - $forum_list = make_forum_select(false, false, true, true, true, false, true); - - // Build forum options - $s_forum_options = ''; - - return $s_forum_options; + return $this->get_forum_select($key); } - function select_exclude_forums($value, $key) + /** + * Select for multiple forums to exclude + * + * @param mixed $value Config value, unused + * @param string $key Config key + * + * @return array Forum select data + */ + public function select_exclude_forums($value, string $key): array + { + return $this->get_forum_select($key, FORUM_OPTION_FEED_EXCLUDE); + } + + /** + * Get forum select data for specified key and option + * + * @param string $key Config key + * @param int $forum_option Forum option bit + * + * @return array Forum select data + */ + protected function get_forum_select(string $key, int $forum_option = FORUM_OPTION_FEED_NEWS): array { $forum_list = make_forum_select(false, false, true, true, true, false, true); // Build forum options - $s_forum_options = ''; - return $s_forum_options; + return [ + 'tag' => 'select', + 'id' => $key, + 'name' => $key . '[]', + 'multiple' => true, + 'options' => $forum_options, + ]; } function store_feed_forums($option, $key) diff --git a/phpBB/phpbb/template/twig/extension/forms.php b/phpBB/phpbb/template/twig/extension/forms.php index 06d5d21328..dc6e28acaa 100644 --- a/phpBB/phpbb/template/twig/extension/forms.php +++ b/phpBB/phpbb/template/twig/extension/forms.php @@ -184,6 +184,7 @@ class forms extends AbstractExtension 'GROUP_ONLY' => (bool) ($form_data['group_only'] ?? false), 'DATA' => $form_data['data'] ?? [], 'SIZE' => (int) ($form_data['size'] ?? 0), + 'MULTIPLE' => (bool) ($form_data['multiple'] ?? false), ]); } catch (\Twig\Error\Error $e) diff --git a/phpBB/styles/all/template/macros/forms/select.twig b/phpBB/styles/all/template/macros/forms/select.twig index 45c84a42ca..70a13b97aa 100644 --- a/phpBB/styles/all/template/macros/forms/select.twig +++ b/phpBB/styles/all/template/macros/forms/select.twig @@ -7,6 +7,7 @@ {% for attribute, attribute_value in DATA %} data-{{ attribute|e }}="{{ attribute_value|e('html_attr') }}" {% endfor %} + {% if MULTIPLE %}multiple="multiple" {% endif %} {% if SIZE %}size="{{ SIZE }}" {% endif %}> {% endapply %} {% for element in OPTIONS %} @@ -19,11 +20,11 @@ {% endfor %}> {% endapply %} {% for option in element.options %} - + {% endfor %} {% else %} - + {% endif %} {% endfor %}