alleyinteractive / alleyinteractive/wordpress-fieldmanager

chosen.js not initialized when display-if field is toggled

Đang mở
#882 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug javascript
Ngôn ngữ chính
PHP
Star
563
Fork
99
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.