1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 02:06:32 +02:00

[ticket/17151] Revert radio yes_no/enabled_disabled, fix select "selected"

PHPBB3-17151
This commit is contained in:
rxu
2023-10-02 11:55:49 +07:00
parent 6349d3c126
commit b6572652df
5 changed files with 223 additions and 121 deletions

View File

@@ -195,9 +195,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
'allow_avatar_' . get_class($this->avatar_foobar) => [
'lang' => 'ALLOW_' . strtoupper(get_class($this->avatar_foobar)),
'validate' => 'bool',
'type' => 'radio',
'function' => 'build_radio',
'params' => ['{CONFIG_VALUE}', '{KEY}', [1 => 'YES', 0 => 'NO']],
'type' => 'radio:yes_no',
'explain' => true
],
];

View File

@@ -260,6 +260,33 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
public function build_cfg_template_radio_data()
{
return [
[
['radio', 'enabled_disabled'],
'key_name',
['config_key_name' => '0'],
'config_key_name',
[],
[
'tag' => 'radio',
'buttons' => [
[
'id' => 'key_name',
'type' => 'radio',
'value' => 1,
'name' => 'config[config_key_name]',
'label' => 'ENABLED',
'checked' => false,
],
[
'type' => 'radio',
'value' => 0,
'checked' => true,
'name' => 'config[config_key_name]',
'label' => 'DISABLED',
],
],
],
],
[
['radio'],
'key_name',
@@ -287,6 +314,33 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
],
],
],
[
['radio', 'enabled_disabled'],
'key_name',
['config_key_name' => '1'],
'config_key_name',
[],
[
'tag' => 'radio',
'buttons' => [
[
'id' => 'key_name',
'type' => 'radio',
'value' => 1,
'name' => 'config[config_key_name]',
'label' => 'ENABLED',
'checked' => true,
],
[
'type' => 'radio',
'value' => 0,
'checked' => false,
'name' => 'config[config_key_name]',
'label' => 'DISABLED',
],
],
],
],
[
['radio'],
'key_name',
@@ -314,6 +368,33 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
],
],
],
[
['radio', 'yes_no'],
'key_name',
['config_key_name' => '0'],
'config_key_name',
[],
[
'tag' => 'radio',
'buttons' => [
[
'id' => 'key_name',
'type' => 'radio',
'value' => 1,
'name' => 'config[config_key_name]',
'label' => 'YES',
'checked' => false,
],
[
'type' => 'radio',
'value' => 0,
'checked' => true,
'name' => 'config[config_key_name]',
'label' => 'NO',
],
],
],
],
[
['radio'],
'key_name',
@@ -341,6 +422,33 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
],
],
],
[
['radio', 'yes_no'],
'key_name',
['config_key_name' => '1'],
'config_key_name',
[],
[
'tag' => 'radio',
'buttons' => [
[
'id' => 'key_name',
'type' => 'radio',
'value' => 1,
'name' => 'config[config_key_name]',
'label' => 'YES',
'checked' => true,
],
[
'type' => 'radio',
'value' => 0,
'checked' => false,
'name' => 'config[config_key_name]',
'label' => 'NO',
],
],
],
],
[
['radio'],
'key_name',