alleyinteractive / alleyinteractive/wordpress-fieldmanager
chosen.js not initialized when display-if field is toggled
- 主要語言
- PHP
- 星號
- 563
- 分支
- 99
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### Description of the bug
When a select field using both `type_ahead` and `display_if` is initially hidden, chosen.js isn't initialized when the field is shown.
### Steps To Reproduce
Test with this group by saving it with `disable_blocks` enabled, and you should see that the typeahead UI on `disable_block_terms` isn't initialized on the next pageload after unchecking `disable_blocks`:
```
new Fieldmanager_Group(
[
'label' => 'Ads',
'children' => [
'disable_blocks' => new \Fieldmanager_Checkbox( 'Disable all blocks' ),
'disable_block_terms' => new Fieldmanager_Select(
[
'label' => 'Disable blocks on these categories',
'datasource' => new Fieldmanager_Datasource_Term(
[
'taxonomy' => 'category',
],
),
'display_if' => [
'src' => 'disable_blocks',
'value' => '0',
],
'multiple' => true,
'type_ahead' => true,
],
),
],
]
)
```
### Additional Information
Adding `fm_displayif_toggle` to this list seems to fix the problem: https://github.com/alleyinteractive/wordpress-fieldmanager/blob/584979f3e59b2173fa71633a07c39c0050b11347/php/class-fieldmanager-select.php#L193
貢獻指南
評估
這個 Issue 還沒有評估資料。