alleyinteractive / alleyinteractive/wordpress-fieldmanager
Fieldmanager_Select option groups are incorrectly adding option values
- 主要语言
- PHP
- 星标
- 563
- 派生
- 99
- PR 合并指标
- 30 天内没有已合并 PR
描述
When creating a Fieldmanager_Select instance using the grouped syntax, the array key is used for the option text and the array value is used for the option value. This is inconsistent from the ungrouped / documented usage.
**Fieldmanager_Select (ungrouped / documented usage)**
``` php
$fm = new Fieldmanager_Select( array(
'name' => 'test_select_ungrouped',
'options' => array(
'zero' => 'Option 0',
'one' => 'Option 1',
'two' => 'Option 2'
)
) );
$fm->add_meta_box( 'Select box (ungrouped)', 'page' );
```
Output (expected):
``` html
Option 0
Option 1
Option 2
```
**Fieldmanager_Select (grouped / undocumented)**
``` php
$fm = new Fieldmanager_Select( array(
'name' => 'test_select_grouped',
'grouped' => true,
'options' => array(
'Group 1' => array(
'group1_zero' => 'Option 0',
'group1_one' => 'Option 1',
'group1_two' => 'Option 2'
),
'Group 2' => array(
'group2_zero' => 'Option 0',
'group2_one' => 'Option 1',
'group2_two' => 'Option 2'
)
)
) );
$fm->add_meta_box( 'Select box (grouped)', 'page' );
```
Output
``` html
group1_zero
group1_one
group1_two
group2_zero
group2_one
group2_two
```
贡献指南
评估
这个 Issue 还没有评估数据。