hussain nayani
hussain nayani

Reputation: 325

Use param of an element as a dependency of param of another element - vc_map()

I am developing Visual Composer Addons and stuck in an issue. I am using Nested Shortcodes

I want to use param from parent element as a dependency of param of child element. Example : If user selects theme-one in parent element than show primary-color field in child element. Is it possible?

Please let me know if I was not clear.

Any help would be appreciated. Thanks in advance. Happy coding.!!

Upvotes: 1

Views: 2499

Answers (1)

NineTheme
NineTheme

Reputation: 21

array(
    'type'        => 'dropdown',
    'heading'     => esc_html__('Box type', 'cursornt' ),
    'param_name'  => 'box',
    'description' => esc_html__('You can select icon size', 'cursornt' ),
    'value'       => array(
        esc_html__('Select position',   'cursornt' )    => '',
        esc_html__('Default',       'cursornt' )    => '1',
        esc_html__('Bordered Box',  'cursornt' )    => '2',
        esc_html__('Bordered Box - Fullwidth',  'cursornt' )    => '3',
        esc_html__('Image Box - Fullwidth',  'cursornt' )   => '4',
    ),
),

array(
    'type'          => 'attach_image',
    'heading'       => esc_html__('BG image', 'cursornt'),
    'param_name'    => 'bgimg',
    'description'   => esc_html__('Add your background image icon', 'cursornt'),
    'dependency'    => array(
        'element'   => 'box',
        'value'     => '4'
    ),
),

check number 4 and it is very easy, if you select Box type "Image Box" then it will show BG image

Upvotes: 1

Related Questions