Relation method is used to link two or multiple parameters together. You can set a parameter shown or hidden depending on another parameter.
For example, the parameter "Stretch Option" will be displayed when the parameter "Full Width" has been checked.
Example:
array(
'name' => 'background-image-option',
'label' => 'BG Image?',
'type' => 'checkbox',
'description' => 'Do you want to use background image?',
'options' => array( 'yes' => 'Yes, Please!' )
),
array(
'name' => 'background-image',
'label' => 'Upload Image',
'type' => 'attach_image_url',
'relation' => array(
'parent' => 'background-image-option',
'show_when' => 'yes'
// 'hide_when' => 'yes'
// hide_when has the opposite effect
// NOTICE: Only use one show_when or hide_when in the same time
// 'show_when' => 'yes,ok,right'
// 'show_when' => array( 'yes', 'ok', 'right' )
)
),
Having trouble with map adding? Please read more about
Add Map.