[wp-trac] [WordPress Trac] #24528: Customizer checkbox with refresh option gives inconsistent values
WordPress Trac
noreply at wordpress.org
Fri Jun 7 07:22:53 UTC 2013
#24528: Customizer checkbox with refresh option gives inconsistent values
--------------------------+-----------------------------
Reporter: nathanrowe82 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.5
Severity: normal | Keywords:
--------------------------+-----------------------------
When adding a checkbox control to the customizer feature with type =
refresh, the value returned is sometimes a string and sometimes a boolean,
when the checkbox is changed.
I've tested this in 3.5, and 3.6-beta3-24407.
How to reproduce in 3.5:
Load the "Twenty Twelve" theme. In the functions file add a test checkbox
setting & control:
{{{
$wp_customize->add_setting('test', array(
'type' => 'option',
'default' => true,
'priority' => 10,
'transport' => 'refresh'
));
$wp_customize->add_control( new WP_Customize_Control( $wp_customize,
'test', array(
'label' => __( 'Test' ),
'section' => 'title_tagline',
'settings' => 'test',
'type' => 'checkbox'
)));
}}}
Dump the value into the index.php of the theme:
{{{
<?php var_dump(get_option('test')); ?>
}}}
This is where things get odd:
Load up the customizer,
'''- Theme should output: bool(true)'''
Toggle the checkbox, allowing for the iframe to refresh each time:
'''All results should be boolean values.'''
Toggle to checkbox to ON, hit save, and refresh the browser window.
'''- Theme should output: string(1) "1"'''
Toggle the checkbox to OFF, allowing for the iframe to refresh:
'''Value does not update'''
Toggle the checkbox some more, allowing for the iframe to refresh each
time:
'''Results will toggle between string(1) "1" and boolean(true)'''
ONE LAST TEST:
Toggle to checkbox to OFF, hit save, and refresh the browser window.
'''- Theme should output: string(0) ""'''
Toggle the checkbox some more, allowing for the iframe to refresh each
time:
'''Results will toggle between string(0) "" and boolean(true)'''
Thanks
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24528>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list