Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Switch is not working in page builder correctly

Open dk-wordpress opened this issue 11 years ago • 6 comments

Hello, team, just a report:

this not working if i use numeric values for Switch (only in page builder, but works in Theme options):

'my_option' => array(
    'label' => __('Some option', 'textdomain'),
    'type' => 'switch',
    'value' => 0,
    'right-choice' => array(
        'value' => 1,
        'label' => __( 'Yes', 'textdomain' )
    ),
    'left-choice' => array(
        'value' => 0,
        'label' => __( 'No', 'textdomain' )
    ),
),

this works fine:

'my_option' => array(
    'label' => __('Some option', 'textdomain'),
    'type' => 'switch',
    'value' => 'no',
    'right-choice' => array(
        'value' => 'yes',
        'label' => __( 'Yes', 'textdomain' )
    ),
    'left-choice' => array(
        'value' => 'no',
        'label' => __( 'No', 'textdomain' )
    ),
),

any ideas how to use numeric values for Switch in Page builder? :)

dk-wordpress avatar Sep 14 '15 09:09 dk-wordpress

p.s. why i need numeric values?

$var == 1 will work faster than $var == 'yes' isn't right?

dk-wordpress avatar Sep 14 '15 11:09 dk-wordpress

I made a fix

Please test all your options, I hope it did not break other options.

ghost avatar Sep 14 '15 13:09 ghost

works for now on the switch but not sure about other options

tested switch with

0 , 1 
false, true
'inactive','active'

worked in all 3 inside section options and than deeper inside addable-popup

danyj avatar Sep 16 '15 11:09 danyj

thank you so much! Can I hope that this fix will be included in the official release?

dk-wordpress avatar Sep 16 '15 12:09 dk-wordpress

@WPJobs Let me know if this feature is critical and urgent for your and I will create a new release approval asap.

If not, we sure will include this in official release but later, when more features and bug fixes will accumulate.

ghost avatar Sep 16 '15 13:09 ghost

it is not critical, thank you a lot for a quick response and fix! :+1:

dk-wordpress avatar Sep 17 '15 08:09 dk-wordpress