alleyinteractive / alleyinteractive/wordpress-fieldmanager
display_if condition doesn't hide active fields that have their own custom display_if condition
- Langage dominant
- PHP
- Étoiles
- 563
- Forks
- 99
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### Description of the bug
As titled.
### Steps To Reproduce
```php
function add_custom_meta_boxes() {
$custom_meta_group = new Fieldmanager_Group(
array(
'name' => 'custom_group',
'children' => array(
'meta' => new Fieldmanager_Checkbox(
[
'save_empty' => false,
'checked_value' => 'meta',
'label' => 'Checkbox',
]
),
'subject_prefix' => new Fieldmanager_Select(
[
'name' => 'subject_prefix',
'label' => 'Subject prefix',
'options' => [
'none' => 'None',
'custom' => 'Custom',
],
'default_value' => 'none',
'display_if' => [ // <--- this field requires the `meta` field to be active.
'src' => 'meta',
'value' => 'meta',
],
]
),
'subject_prefix_custom' => new Fieldmanager_Textfield(
[
'label' => 'Custom subject prefix',
'display_if' => [ // <--- this field requires the `subject_prefix` field to be active and indirectly, the `meta` field too.
'src' => 'subject_prefix',
'value' => 'custom',
],
]
),
),
)
);
// Add the group to a post type
$custom_meta_group->add_meta_box( 'Custom Meta', 'your-post-type', 'normal', 'high' );
}
add_action( 'admin_init', 'add_custom_meta_boxes' );
```
https://github.com/user-attachments/assets/5affc393-f997-47f0-bf3a-6c8ea064a746
### Additional Information
_No response_
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.