[wp-trac] [WordPress Trac] #29948: Use contextual controls (active_callback) API for conditionally-displayed core contextual controls
WordPress Trac
noreply at wordpress.org
Mon Oct 13 18:24:27 UTC 2014
#29948: Use contextual controls (active_callback) API for conditionally-displayed
core contextual controls
------------------------------+------------------------------
Reporter: celloexpressions | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.0
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
------------------------------+------------------------------
Comment (by westonruter):
You're referring to this code?
{{{
#!js
// Control visibility for default controls
$.each({
'background_image': {
controls: [ 'background_repeat',
'background_position_x', 'background_attachment' ],
callback: function( to ) { return !! to; }
},
'show_on_front': {
controls: [ 'page_on_front',
'page_for_posts' ],
callback: function( to ) { return 'page'
=== to; }
},
'header_textcolor': {
controls: [ 'header_textcolor' ],
callback: function( to ) { return 'blank'
!== to; }
}
}, function( settingId, o ) {
api( settingId, function( setting ) {
$.each( o.controls, function( i, controlId
) {
api.control( controlId, function(
control ) {
var visibility = function(
to ) {
control.container.toggle( o.callback( to ) );
};
visibility( setting.get()
);
setting.bind( visibility
);
});
});
});
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29948#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list