alleyinteractive / alleyinteractive/wordpress-fieldmanager

display_if only works with single value in Fieldmanager_Checkboxes

Aperta
#498 2 commenti 0 reazioni 1 assegnatario Rivendicata da @dlh01 Vedi su GitHub
bug scope:display-if
Lingua principale
PHP
Stelle
563
Fork
99
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have two separate fields set to `display_if` based on two separate values in a `Fieldmanager_Checkboxes` field. While this does work as a trigger, only one of the conditional fields can appear at the same time.

If two conditional fields depend on the same set of checkboxes, only one conditional field can be displayed at a time — only the most recently selected checkbox triggers the conditional field.

![](http://cl.montchr.io/030j3u1c0c2L/Screen%20Recording%202016-05-10%20at%2009.49.gif)

Here is the basic structure of the fields (excess stuff omitted, just showing relevant fields here):

``` php
$placement_fields = [
'type' => new \Fieldmanager_Checkboxes( esc_html__( 'Type', 'pedestal' ), [
'options' => [
'post_type' => 'Post Type',
'post' => 'Single Post',
],
] ),
'post_type' => new \Fieldmanager_Checkboxes( esc_html__( 'Post Type', 'pedestal' ), [
'display_if' => [
'src' => 'type',
'value' => 'post_type',
],
'options' => $post_type_support,
] ),
'post' => new \Fieldmanager_Autocomplete( esc_html__( 'Post', 'pedestal' ), [
'name' => 'post',
'attributes' => [
'placeholder' => esc_html__( 'Search by post title', 'pedestal' ),
'size' => 50,
],
'display_if' => [
'src' => 'type',
'value' => 'post',
],
'datasource' => new \Fieldmanager_Datasource_Post( [
'query_args' => [
'post_type' => Types::get_post_types_by_supported_feature( 'slots' ),
],
] ),
] ),
];
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.