Custom Fields
Re-Envisioned
Support Meta Box Group Clonable Group inherits previous conditional fields

This topic contains 1 reply, has 2 voices, and was last updated by  Tan Nguyen 1 year, 10 months ago.

  • Creator
    Topic
  • #5960
    Resolved
    Internative
    Participant

    Hi,

    When I clone a group it automatically inherits the conditional field chosen in the previous group.
    Is there a way to reset a group upon cloning or is this a bug?

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #5983

    Tan Nguyen
    Participant

    Dear Internative,

    I’ve double checked the plugin and see that it works properly. Here is my code from the group example:

    
    add_filter( 'rwmb_meta_boxes', 'meta_box_group_demo_register' );
    function meta_box_group_demo_register( $meta_boxes ) {
    	$meta_boxes[] = array(
    		'title'  => __( 'Album Tracks' ),
    		'fields' => array(
    			array(
    				'id'     => 'standard',
    				// Group field
    				'type'   => 'group',
    				// Clone whole group?
    				'clone'  => true,
    				// Drag and drop clones to reorder them?
    				'sort_clone' => true,
    				// Sub-fields
    				'fields' => array(
                        array(
    						'name'    => __( 'Genre', 'rwmb' ),
    						'id'      => 'genre',
    						'type'    => 'select_advanced',
    						'options' => array(
    							'pop'  => __( 'Pop', 'rwmb' ),
    							'rock' => __( 'Rock', 'rwmb' ),
    						),
    					),
    					array(
    						'name' => __( 'Track name', 'rwmb' ),
    						'id'   => 'text',
    						'type' => 'text',
                            'visible' => ['genre', '!=', '']
    					),
    					array(
    						'name' => __( 'Release Date', 'rwmb' ),
    						'id'   => 'date',
    						'type' => 'date',
                            'visible' => ['genre', '!=', '']
    					),
    				),
    			),
    		),
    	);
    	return $meta_boxes;
    }
    

    Can you please paste your code here so I can check?

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.