-
- // Update the model with whether or not the sidebar is rendered
- self.active.bind( function ( active ) {
- registeredSidebar.set( 'is_rendered', active );
- } );
- },
-
- /**
- * Show the sidebar section when it becomes visible.
- *
- * Overrides api.Control.toggle()
- *
- * @param {Boolean} active
- */
- toggle: function ( active ) {
- var $section, sectionSelector;
-
- sectionSelector = '#accordion-section-sidebar-widgets-' + this.params.sidebar_id;
- $section = $( sectionSelector );
-
- if ( active ) {
- $section.stop().slideDown( function() {
- $( this ).css( 'height', 'auto' ); // so that the .accordion-section-content won't overflow
- } );
-
- } else {
- // Make sure that hidden sections get closed first
- if ( $section.hasClass( 'open' ) ) {
- // it would be nice if accordionSwitch() in accordion.js was public
- $section.find( '.accordion-section-title' ).trigger( 'click' );
- }
-
- $section.stop().slideUp();
- }