• Resolved Stormit

    (@stormit)


    Hi,

    We have a problem with the default value of control. Below is our code:

    $this->add_control(
                'style'
                ,array(
                    'label' 		=> 'Style'
                    ,'type' 		=> Controls_Manager::SELECT
                    ,'default' 		=> 'style-grid'
    		,'options'		=> array(
    			'style-grid' 			=> 'Grid'
    			,'style-list' 			=> 'List'
    			)		
                    ,'description' 	=> ''
                )
            );
    		
    	$this->add_control(
                'img_bg'
                ,array(
                    'label' 		=> 'Heading Background Image'
                    ,'type' 		=> Controls_Manager::MEDIA
                    ,'default' 		=> array( 'id' => '', 'url' => '' )		
                    ,'description' 	=> ''
    		,'condition'	=> array( 'style' => 'style-list' )
                )
            );

    If we don’t select image for the Heading Background Image control. We set the Style control to Grid. The value of the $img_bg variable is NULL. The value of the $img_bg variable should be array( ‘id’ => ”, ‘url’ => ” ) (default).

    This may cause error in som cases. When the control is not set, it should use the default value. Please fix this issue!

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Default Value of Control’ is closed to new replies.