Support Forum
Support › Meta Box Group › Cloned group with conditional logic won't work properly
Hello,
I'm trying to make groups with different options cloneable.
In this groups I have options with conditional elements.
The first group works fine, but the elements in a cloned group won't react to my actions. (Only when i change something in the first group the cloned group change)
This is my code:
// Content Columns
// Content columns number
$column_number[1] = __( '1 Column', 'internative' );
$column_number[2] = __( '2 Columns', 'internative' );
$column_number[3] = __( '3 Columns', 'internative' );
// Content columns options
$column_content_type['wysiwyg'] = __( 'Text editor', 'internative' );
$column_content_type['photo'] = __( 'Photo', 'internative' );
$column_content_type['video'] = __( 'Video', 'internative' );
// Meta Boxes for all the pages
$meta_boxes[] = array(
'id' => 'content_columns',
'title' => __( 'Content columns', 'internative' ),
'post_types' => array( 'page','inn_vacature' ),
'fields' => array(
array(
'id' => 'content_column',
'type' => 'group',
'clone' => true,
'sort_clone' => true,
'fields' => array(
array(
'name' => __( 'Select number of columns', 'internative' ),
'id' => "{$prefix}content_column_select",
'type' => 'select_advanced',
'options' => $column_number,
'placeholder' => __( 'Please select…', 'internative' ),
),
// Column 1
array(
'name' => __( 'Select column 1 type', 'internative' ),
'id' => "{$prefix}content_column_1_type",
'type' => 'radio',
'options' => $column_content_type,
'visible' => array( "{$prefix}content_column_select", '>', 0 ),
),
// Column 1 editor
array(
'name' => __( 'Title', 'internative' ),
'id' => "{$prefix}content_column_1_title",
'type' => 'text',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_1_type", 'wysiwyg' ),
),
),
),
array(
'name' => __( 'Content', 'internative' ),
'id' => "{$prefix}content_column_1_text",
'type' => 'wysiwyg',
'options' => array(
'editor_height' => 250
),
'visible' => array(
'when' => array(
array( "{$prefix}content_column_1_type", 'wysiwyg' ),
),
),
),
// Column 1 photo
array(
'name' => __( 'Photo', 'internative' ),
'id' => "{$prefix}content_column_1_photo",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'visible' => array(
'when' => array(
array( "{$prefix}content_column_1_type", 'photo' ),
),
),
),
// Column 1 video
array(
'name' => __( 'Video', 'internative' ),
'id' => "{$prefix}content_column_1_video",
'type' => 'oembed',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_1_type", 'video' ),
)
),
'desc' => __( 'YouTube only', 'internative' ),
),
// Column 2
array(
'name' => __( 'Select column 2 type', 'internative' ),
'id' => "{$prefix}content_column_2_type",
'type' => 'radio',
'options' => $column_content_type,
'visible' => array( "{$prefix}content_column_select", '>', 1 ),
),
// Column 2 editor
array(
'name' => __( 'Title', 'internative' ),
'id' => "{$prefix}content_column_2_title",
'type' => 'text',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_2_type", 'wysiwyg' ),
),
),
),
array(
'name' => __( 'Content', 'internative' ),
'id' => "{$prefix}content_column_2_text",
'type' => 'wysiwyg',
'options' => array(
'editor_height' => 250
),
'visible' => array(
'when' => array(
array( "{$prefix}content_column_2_type", 'wysiwyg' ),
),
),
),
// Column 2 photo
array(
'name' => __( 'Photo', 'internative' ),
'id' => "{$prefix}content_column_2_photo",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'visible' => array(
'when' => array(
array( "{$prefix}content_column_2_type", 'photo' ),
),
),
),
// Column 2 video
array(
'name' => __( 'Video', 'internative' ),
'id' => "{$prefix}content_column_2_video",
'type' => 'oembed',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_2_type", 'video' ),
)
),
'desc' => __( 'YouTube only', 'internative' ),
),
// Column 3
array(
'name' => __( 'Select column 3 type', 'internative' ),
'id' => "{$prefix}content_column_3_type",
'type' => 'radio',
'options' => $column_content_type,
'visible' => array( "{$prefix}content_column_select", '>', 2 ),
),
// Column 3 editor
array(
'name' => __( 'Title', 'internative' ),
'id' => "{$prefix}content_column_3_title",
'type' => 'text',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_3_type", 'wysiwyg' ),
),
),
),
array(
'name' => __( 'Content', 'internative' ),
'id' => "{$prefix}content_column_3_text",
'type' => 'wysiwyg',
'options' => array(
'editor_height' => 250
),
'visible' => array(
'when' => array(
array( "{$prefix}content_column_3_type", 'wysiwyg' ),
),
),
),
// Column 3 photo
array(
'name' => __( 'Photo', 'internative' ),
'id' => "{$prefix}content_column_3_photo",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'visible' => array(
'when' => array(
array( "{$prefix}content_column_3_type", 'photo' ),
),
),
),
// Column 3 video
array(
'name' => __( 'Video', 'internative' ),
'id' => "{$prefix}content_column_3_video",
'type' => 'oembed',
'visible' => array(
'when' => array(
array( "{$prefix}content_column_3_type", 'video' ),
),
),
'desc' => __( 'YouTube only', 'internative' ),
),
),
),
),
);
// END Content Colums
I'm hoping there is a solution for this.
Thanks in advanced!
Dear Internative,
The latest Group version has updated the html output so it breaks my Conditional Logic function. I'll update the Conditional Logic plugin this week.
Best regards,
Tan
That would be great!
Thanks
V1.4.1 bumped! Please update.
Nice, it works! 🙂
Thank you very much!