• Please check this problem.

    
    array(
        'type'          => 'group',
        'label'         => __('Options', 'maxvid'),
        'name'          => 'banner_slider_items',
        'description'   => __( 'Repeat this fields with each item created, Each item corresponding element.', 'maxvid' ),
        'options'       => array('add_text' => __('Add new Slider', 'maxvid')),
    
        'params' => array(
            array(
                'name'             => 'slider_type',
                'admin_label' => false,
                'type'           => 'select',
                'label'          => 'Select Slider Background Setting',
                'options'        => array(
                    'image'        => 'Image',
                    'video'        => 'Video',
                ),
                'value'  => 'video',
            ),
            array(
                'name'    => 'banner_slider_bgimg',
                'admin_label' => false,
                'type'  => 'attach_image',
                'label' => 'Slider Background Image',
                'relation'  => array(
                    'parent'    => 'slider_type',
                    'show_when' => 'image',
                )
            ),
            array(
                'name'    => 'banner_slider_bg_video',
                'type'  => 'text',
                'admin_label' => false,
                'label' => 'Slider Background Video',
                'value' => 'YOUTUBE LINK',
                'relation'  => array(
                    'parent'    => 'slider_type',
                    'show_when' => 'video',
                )
            ),
        ),
    )
    

    I add this one in a group, but relation feature not working.

Viewing 1 replies (of 1 total)
  • Use this code:-

    'relation' => array(){
          'parent' => {group-field-name}+'-'+{child-field-name},
          'show_when' => {value_of_parent}
          //'hide_when' => {value_of_parent} 
          // Use only one show_when or hide_when
    }

    ex:-

    'relation'  => array(
        'parent' => 'banner_slider_items-slider_type',
        'show_when' => 'image',
    )
    • This reply was modified 5 years, 3 months ago by MonparaAshvin.
Viewing 1 replies (of 1 total)
  • The topic ‘‘relation’ is not work in group field’ is closed to new replies.