Customizer: Defer rendering theme controls until the section is displayed.
see #31793. git-svn-id: https://develop.svn.wordpress.org/trunk@31944 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
78469b71b0
commit
5283d55271
|
@ -1859,6 +1859,28 @@
|
||||||
|
|
||||||
touchDrag: false,
|
touchDrag: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defer rendering the theme control until the section is displayed.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*/
|
||||||
|
renderContent: function () {
|
||||||
|
var control = this,
|
||||||
|
renderContentArgs = arguments;
|
||||||
|
|
||||||
|
api.section( control.section(), function ( section ) {
|
||||||
|
if ( section.expanded() ) {
|
||||||
|
api.Control.prototype.renderContent.apply( control, renderContentArgs );
|
||||||
|
} else {
|
||||||
|
section.expanded.bind( function ( expanded ) {
|
||||||
|
if ( expanded ) {
|
||||||
|
api.Control.prototype.renderContent.apply( control, renderContentArgs );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 4.2.0
|
* @since 4.2.0
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue