Support Meta Box Conditional Logic Conditional logic not working with clones in groups Reply To: Conditional logic not working with clones in groups

#8485
nppnpp
Participant

Hmm can't edit the post. So the code is currently:


$prefix = '_something_';

$meta_boxes[] = array(
    'title'      => 'Box settings',
    'post_types' => 'page',
    'fields'     => array(
        array(
            'id'          	=> $prefix . 'test',
            'name'        	=> 'Image or video boxes',
            'type'        	=> 'group',
            'clone'       	=> true,
            'sort_clone'  	=> true,
            'collapsible' 	=> true,
            'default_state'	=> 'collapsed',
            'group_title' 	=> 'Box #{#}',
            'save_state' 	=> true,

            'fields' 		=> array(
				array(
				    'name'    			=> 'Image or video?',
				    'id'      			=> $prefix . 'type123',
				    'type'    			=> 'radio',
				    'options' 			=> [ 'img' => 'Image', 'vid' => 'Video', ],
				    'std'				=> 'img',
				    'inline' 			=> false,
				),
				array(
				    'id'               	=> $prefix . 'image',
				    'name'             	=> 'Choose image',
				    'type'             	=> 'image_advanced',
				    'force_delete'     	=> false,
				    'max_file_uploads' 	=> 1,
				    'max_status'       	=> false,
				    'image_size'       	=> 'thumbnail',
				    'visible' 			=> [ $prefix . 'type123', 'img' ], // <-- not working
				),
				array(
				    'id'               	=> $prefix . 'video',
				    'name'             	=> 'Choose video',
				    'type'             	=> 'video',
				    'force_delete'     	=> false,
				    'max_file_uploads' 	=> 1,
				    'max_status'       	=> false,
				    'visible' 			=> [ $prefix . 'type123', 'vid' ], // <-- not working
				),
            ),
        ),
    ),
);

And the above video applies. As you can see, it does not function as intended. It resets the value when you clone as for radio, it shows image selection by default outside collapse although being in collapsed state by default.. Yeah I can't get this to work.