alleyinteractive / alleyinteractive/wordpress-fieldmanager

Fieldmanager_Select option groups are incorrectly adding option values

未关闭
#381 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。