diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 1e82c0e6d5..1babdceb01 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -970,10 +970,10 @@ class acp_board
{
list($available, $value) = $data;
$act_options[] = [
- 'value' => $value,
- 'selected' => $selected_value == $value,
- 'label' => $user->lang($key),
- 'disabled' => !$available,
+ 'value' => $value,
+ 'selected' => $selected_value == $value,
+ 'label' => $user->lang($key),
+ 'class' => !$available ? 'disabled-option' : '',
];
}
diff --git a/phpBB/styles/all/template/macros/forms/select.twig b/phpBB/styles/all/template/macros/forms/select.twig
index 1ff690268f..052cf89f9b 100644
--- a/phpBB/styles/all/template/macros/forms/select.twig
+++ b/phpBB/styles/all/template/macros/forms/select.twig
@@ -24,14 +24,14 @@
+ {% if option.disabled %} disabled="disabled"{% endif %}{% if option.class %} class="{{ option.class }}"{% endif %}>{{ option.label }}
{% endfor %}
{% else %}
{% endif %}
{% endfor %}
diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php
index e06b5f845d..a9efdbc0ad 100644
--- a/tests/acp_board/select_auth_method_test.php
+++ b/tests/acp_board/select_auth_method_test.php
@@ -22,8 +22,36 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
public static function select_auth_method_data()
{
return [
- ['acp_board_valid', ''],
- ['acp_board_invalid', ''],
+ [
+ 'acp_board_valid',
+ [
+ 'options' => [
+ 0 => [
+ 'value' => 'acp_board_valid',
+ 'label' => 'Acp_board_valid',
+ 'selected' => true,
+ 'data' => [
+ 'toggle-setting' => '#auth_acp_board_valid_settings',
+ ],
+ ]
+ ],
+ ]
+ ],
+ [
+ 'acp_board_invalid',
+ [
+ 'options' => [
+ 0 => [
+ 'value' => 'acp_board_valid',
+ 'label' => 'Acp_board_valid',
+ 'selected' => false,
+ 'data' => [
+ 'toggle-setting' => '#auth_acp_board_valid_settings',
+ ],
+ ]
+ ],
+ ]
+ ],
];
}
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
index 08cb73da07..660d7eb1c9 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
@@ -125,11 +125,25 @@ class main_module
function create_select()
{
- return '
-
-
-
- ';
+ return [
+ 'options' => [
+ [
+ 'value' => 1,
+ 'selected' => true,
+ 'label' => 'Option 1',
+ ],
+ [
+ 'value' => 2,
+ 'selected' => false,
+ 'label' => 'Option 2',
+ ],
+ [
+ 'value' => 3,
+ 'selected' => false,
+ 'label' => 'Option 3',
+ ],
+ ]
+ ];
}
function submit_button()
diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php
index e36b799bde..aadacadb02 100644
--- a/tests/functions/style_select_test.php
+++ b/tests/functions/style_select_test.php
@@ -20,14 +20,119 @@ class phpbb_functions_style_select_test extends phpbb_database_test_case
static public function style_select_data()
{
- return array(
- array('', false, ''),
- array('', true, ''),
- array('1', false, ''),
- array('1', true, ''),
- array('3', false, ''),
- array('3', true, ''),
- );
+ return [
+ [
+ '',
+ false,
+ [
+ [
+ 'value' => '1',
+ 'selected' => false,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ ]
+ ],
+ [
+ '',
+ true,
+ [
+ [
+ 'value' => '1',
+ 'selected' => false,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ [
+ 'value' => '3',
+ 'selected' => false,
+ 'label' => 'zoo',
+ ],
+ ]
+ ],
+ [
+ '1',
+ false,
+ [
+ [
+ 'value' => '1',
+ 'selected' => true,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ ]
+ ],
+ [
+ '1',
+ true,
+ [
+ [
+ 'value' => '1',
+ 'selected' => true,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ [
+ 'value' => '3',
+ 'selected' => false,
+ 'label' => 'zoo',
+ ],
+ ]
+ ],
+ [
+ '3',
+ false,
+ [
+ [
+ 'value' => '1',
+ 'selected' => false,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ ]
+ ],
+ [
+ '3',
+ true,
+ [
+ [
+ 'value' => '1',
+ 'selected' => false,
+ 'label' => 'prosilver',
+ ],
+ [
+ 'value' => '2',
+ 'selected' => false,
+ 'label' => 'subsilver2',
+ ],
+ [
+ 'value' => '3',
+ 'selected' => true,
+ 'label' => 'zoo',
+ ],
+ ]
+ ],
+ ];
}
/**
diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php
index 8153fdfabf..53a1ef3045 100644
--- a/tests/functions_acp/build_cfg_template_test.php
+++ b/tests/functions_acp/build_cfg_template_test.php
@@ -431,8 +431,11 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
['method' => 'select_helper'],
[
'tag' => 'select',
+ 'class' => false,
'id' => 'key_name',
+ 'data' => [],
'name' => 'config[config_key_name]',
+ 'toggleable' => false,
'options' => [
[
'value' => 1,
@@ -450,7 +453,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
'selected' => false,
]
],
- 'toggleable' => false,
+ 'group_only' => false,
+ 'size' => 1,
+ 'multiple' => false,
],
],
[
@@ -461,9 +466,11 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
['method' => 'select_helper'],
[
'tag' => 'select',
+ 'class' => false,
'id' => 'key_name',
+ 'data' => [],
'name' => 'config[config_key_name]',
- 'size' => 8,
+ 'toggleable' => false,
'options' => [
[
'value' => 1,
@@ -481,7 +488,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
'selected' => false,
]
],
- 'toggleable' => false,
+ 'group_only' => false,
+ 'size' => 8,
+ 'multiple' => false,
],
],
];