Not working with conditional check from inside group
Support › MB Conditional Logic › Not working with conditional check from inside group
- This topic has 1 reply, 2 voices, and was last updated 5 years, 11 months ago by
Anh Tran.
-
AuthorPosts
-
May 13, 2019 at 6:43 PM #14522
aaron
ParticipantI have a page builder style metabox area and for some reason the visibility doesn't toggle for the group items.
I'm trying to show / hide the single_image field depending on a selection from the select_advanced metabox, But this condition doesn't perform any checks:
'visible' => ["{$builder_prefix}style", 'image_top_text_below'],
/** * Layout: Columns */ array( 'name' => 'Column Style', 'id' => "{$builder_prefix}style", 'type' => 'select_advanced', 'options' => array( 'image_top_text_below' => 'Image top, text below', 'text_with_background' => 'Text with background', ), 'multiple' => false, 'placeholder' => 'Choose your layout', ), array( 'name' => 'Column Count', 'id' => "{$prefix}column_count", 'type' => 'radio', 'inline' => 'true', 'options' => array( '2' => '2', '3' => '3', ), ), // Columns Group array( 'id' => "{$column_prefix}group", 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'collapsible' => true, 'save_state' => true, 'default_state' => 'expanded', 'group_title' => array('field' => "{$column_prefix}title" ), 'add_button' => '+ Column', 'fields' => array( array( 'name' => 'Column Image', 'id' => "{$column_prefix}image", 'type' => 'single_image', 'visible' => ["{$builder_prefix}style", 'image_top_text_below'], ), array( 'name' => 'Column Title', 'id' => "{$column_prefix}title", 'type' => 'text', ), array( 'name' => 'Column Text', 'id' => "{$column_prefix}text", 'type' => 'wysiwyg', 'raw' => false, 'options' => array( 'textarea_rows' => 3, 'teeny' => true, 'media_buttons' => false, ), ), ), ), // end Group
May 14, 2019 at 8:21 AM #14532Anh Tran
KeymasterHi aaron,
The problem here relates to the scope of the conditions. When a condition is put on a field that inside a cloneable group, the plugin sets the scope = the group. So it searches for elements inside the group only.
In this case, the scope of the condition for the field "Column Image" is the group. And the plugin can't search outside it.
-
AuthorPosts
- You must be logged in to reply to this topic.