<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28861] trunk/src: Customizer: Introduce a "panel" API to organize multiple sections into a one section.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28861">28861</a></dd>
<dt>Author</dt> <dd>ocean90</dd>
<dt>Date</dt> <dd>2014-06-26 20:16:21 +0000 (Thu, 26 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Customizer: Introduce a "panel" API to organize multiple sections into a one section.

Create a panel via `$GLOBALS['wp_customize']->add_panel( $panel_id, $args )` and use `$panel_id` for the `panel` argument in `$GLOBALS['wp_customize']->add_section( $section_id, $args )`. That's it.
As an example all widget area sections are now summarized into one panel. Feedback appreciated.

props celloexpressions.
see <a href="http://core.trac.wordpress.org/ticket/27406">#27406</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscolors_adminscss">trunk/src/wp-admin/css/colors/_admin.scss</a></li>
<li><a href="#trunksrcwpadmincsscustomizecontrolscss">trunk/src/wp-admin/css/customize-controls.css</a></li>
<li><a href="#trunksrcwpadmincustomizephp">trunk/src/wp-admin/customize.php</a></li>
<li><a href="#trunksrcwpadminjsaccordionjs">trunk/src/wp-admin/js/accordion.js</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizemanagerphp">trunk/src/wp-includes/class-wp-customize-manager.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizesectionphp">trunk/src/wp-includes/class-wp-customize-section.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizewidgetsphp">trunk/src/wp-includes/class-wp-customize-widgets.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunksrc">trunk/src/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx">Index: trunk/src
</span><span class="cx">===================================================================
</span><del>--- trunk/src   2014-06-26 19:07:03 UTC (rev 28860)
</del><ins>+++ trunk/src    2014-06-26 20:16:21 UTC (rev 28861)
</ins><a id="trunksrc"></a>
<div class="propset"><h4>Property changes: trunk/src</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="modfile"><h4>Modified: svn:ignore</h4></div>
<span class="cx"> .wp-tests-version
</span><span class="cx"> .htaccess
</span><ins>+web-store-experiences
</ins><a id="trunksrcwpadmincsscolors_adminscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/colors/_admin.scss (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/colors/_admin.scss        2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-admin/css/colors/_admin.scss   2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -472,6 +472,11 @@
</span><span class="cx">  color: $menu-highlight-text;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.control-panel-back:focus,
+.control-panel-back:hover {
+       background-color: $menu-highlight-background;
+       color: $menu-highlight-text;
+}
</ins><span class="cx"> 
</span><span class="cx"> /* jQuery UI Slider */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpadmincsscustomizecontrolscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/customize-controls.css (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/customize-controls.css    2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-admin/css/customize-controls.css       2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -32,6 +32,11 @@
</span><span class="cx">  display: block;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#customize-controls .wp-full-overlay-sidebar-content {
+       overflow-y: auto;
+       overflow-x: hidden;
+}
+
</ins><span class="cx"> #customize-info {
</span><span class="cx">  border: none;
</span><span class="cx">  border-top: 1px solid #ddd;
</span><span class="lines">@@ -83,11 +88,6 @@
</span><span class="cx">  line-height: 20px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#customize-theme-controls {
-       -webkit-box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1);
-       box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.1);
-}
-
</del><span class="cx"> #customize-theme-controls .control-section {
</span><span class="cx">  border: none;
</span><span class="cx"> }
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">  background: white;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#customize-theme-controls .control-section:hover .accordion-section-title,
</del><ins>+#customize-theme-controls .control-section:hover > .accordion-section-title,
</ins><span class="cx"> #customize-theme-controls .control-section .accordion-section-title:hover,
</span><span class="cx"> #customize-theme-controls .control-section.open .accordion-section-title,
</span><span class="cx"> #customize-theme-controls .control-section .accordion-section-title:focus {
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">  background: #f5f5f5;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#customize-theme-controls .control-section:hover .accordion-section-title::after,
</del><ins>+#customize-theme-controls .control-section:hover > .accordion-section-title::after,
</ins><span class="cx"> #customize-theme-controls .control-section .accordion-section-title:hover::after,
</span><span class="cx"> #customize-theme-controls .control-section.open .accordion-section-title::after,
</span><span class="cx"> #customize-theme-controls .control-section .accordion-section-title:focus::after {
</span><span class="lines">@@ -143,6 +143,138 @@
</span><span class="cx">  margin: 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.control-section.control-panel > .accordion-section-title:after {
+       content: "\f139";
+}
+
+.accordion-sub-container.control-panel-content {
+       display: none;
+       position: absolute;
+       left: 300px;
+       top: 0;
+       width: 300px;
+       border-top: 1px solid #ddd;
+       -webkit-transition: left ease-in-out .18s;
+       transition: left ease-in-out .18s;
+}
+
+.accordion-sub-container.control-panel-content.animating {
+       display: block;
+}
+
+.current-panel .accordion-sub-container.control-panel-content {
+       width: 100%;
+}
+
+.control-panel-back {
+       display: block;
+       position: fixed;
+       top: 0;
+       z-index: 99;
+       left: -48px;
+       width: 45px;
+       height: 45px;
+       padding-right: 2px;
+       background: #eee;
+       border-right: 1px solid #ddd;
+       cursor: pointer;
+       -webkit-transition: left ease-in-out .18s, color ease-in .1s;
+       transition: left ease-in-out .18s, color ease-in .1s;
+}
+
+.collapsed .control-panel-back {
+       display: none;
+}
+
+.control-panel-back:focus,
+.control-panel-back:hover {
+       background-color: #0074a2;
+       color: #fff;
+       outline: none;
+}
+
+.control-panel-back:before {
+       font: normal 29px/1 dashicons;
+       content: "\f340";
+       position: relative;
+       top: 9px;
+       left: 9px;
+}
+
+.current-panel .control-panel-back {
+       left: 0;
+}
+
+.current-panel > .accordion-section-title {
+       height: 22px;
+}
+
+#customize-header-actions a.back {
+       position: relative;
+       left: 0;
+       -webkit-transition: left ease-in-out .18s;
+       transition: left ease-in-out .18s;
+}
+
+.in-sub-panel #customize-header-actions a.back {
+       left: -120px;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-header {
+       -webkit-transition: padding ease-in-out .18s;
+       transition: padding ease-in-out .18s;
+}
+
+.in-sub-panel .wp-full-overlay-sidebar .wp-full-overlay-header {
+       padding-left: 62px;
+}
+
+#customize-info,
+#customize-theme-controls > ul > .accordion-section {
+       position: relative;
+       left: 0;
+       -webkit-transition: left ease-in-out .18s;
+       transition: left ease-in-out .18s;
+}
+
+.in-sub-panel #customize-info,
+.in-sub-panel #customize-theme-controls > ul > .accordion-section {
+       left: -300px;
+       width: 300px;
+}
+
+.in-sub-panel #customize-theme-controls .accordion-section.current-panel {
+       width: 100%;
+}
+
+#customize-theme-controls .control-section.current-panel {
+       padding: 0;
+}
+
+#customize-theme-controls .control-section > h3.accordion-section-title {
+       position: relative;
+       left: 0;
+}
+
+#customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
+       left: -300px;
+       -webkit-transition: left ease-in-out .18s;
+       transition: left ease-in-out .18s;
+}
+
+.control-section.control-panel .accordion-section-title .panel-title {
+       font-size: 20px;
+       font-weight: 200;
+       line-height: 24px;
+       display: block;
+       border: none;
+}
+
+.control-section.control-panel .preview-notice {
+       font-size: 13px;
+       line-height: 24px;
+}
+
</ins><span class="cx"> .customize-control {
</span><span class="cx">  width: 100%;
</span><span class="cx">  float: left;
</span></span></pre></div>
<a id="trunksrcwpadmincustomizephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/customize.php (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/customize.php 2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-admin/customize.php    2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -142,8 +142,12 @@
</span><span class="cx"> 
</span><span class="cx">                  <div id="customize-theme-controls"><ul>
</span><span class="cx">                          <?php
</span><del>-                               foreach ( $wp_customize->sections() as $section )
</del><ins>+                                foreach ( $wp_customize->panels() as $panel ) {
+                                       $panel->maybe_render();
+                               }
+                               foreach ( $wp_customize->sections() as $section ) {
</ins><span class="cx">                                   $section->maybe_render();
</span><ins>+                               }
</ins><span class="cx">                           ?>
</span><span class="cx">                  </ul></div>
</span><span class="cx">          </div>
</span></span></pre></div>
<a id="trunksrcwpadminjsaccordionjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/accordion.js (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/accordion.js       2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-admin/js/accordion.js  2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -4,13 +4,26 @@
</span><span class="cx"> 
</span><span class="cx">          // Expand/Collapse on click
</span><span class="cx">          $( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
</span><del>-                       if ( e.type === 'keydown' && 13 !== e.which ) // "return" key
-                                       return;
</del><ins>+                        if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
+                               return;
+                       }
+
</ins><span class="cx">                   e.preventDefault(); // Keep this AFTER the key filter above
</span><span class="cx"> 
</span><span class="cx">                  accordionSwitch( $( this ) );
</span><span class="cx">          });
</span><span class="cx"> 
</span><ins>+               // Back to top level
+               $( '.accordion-container' ).on( 'click keydown', '.control-panel-back', function( e ) {
+                       if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
+                               return;
+                       }
+
+                       e.preventDefault(); // Keep this AFTER the key filter above
+
+                       panelSwitch( $( this ) );
+               });
+
</ins><span class="cx">           // Re-initialize accordion when screen options are toggled
</span><span class="cx">          $( '.hide-postbox-tog' ).click( function () {
</span><span class="cx">                  accordionInit();
</span><span class="lines">@@ -33,9 +46,15 @@
</span><span class="cx">                  siblings = section.closest( '.accordion-container' ).find( '.open' ),
</span><span class="cx">                  content = section.find( sectionContent );
</span><span class="cx"> 
</span><del>-               if ( section.hasClass( 'cannot-expand' ) )
</del><ins>+                if ( section.hasClass( 'cannot-expand' ) ) {
</ins><span class="cx">                   return;
</span><ins>+               }
</ins><span class="cx"> 
</span><ins>+               if ( section.hasClass( 'control-panel' ) ) {
+                       panelSwitch( section );
+                       return;
+               }
+
</ins><span class="cx">           if ( section.hasClass( 'open' ) ) {
</span><span class="cx">                  section.toggleClass( 'open' );
</span><span class="cx">                  content.toggle( true ).slideToggle( 150 );
</span><span class="lines">@@ -49,6 +68,30 @@
</span><span class="cx">          accordionInit();
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       function panelSwitch( panel ) {
+               var position,
+                       section = panel.closest( '.accordion-section' ),
+                       container = section.closest( '.wp-full-overlay' ),
+                       siblings = container.find( '.accordion-section.open' ),
+                       content = section.find( '.control-panel-content' );
+
+               if ( section.hasClass( 'current-panel' ) ) {
+                       section.toggleClass( 'current-panel' );
+                       container.toggleClass( 'in-sub-panel' );
+                       content.delay( 180 ).hide( 0, function() {
+                               content.css( 'margin-top', 'inherit' ); // Reset
+                       } );
+               } else {
+                       siblings.removeClass( 'open' );
+                       content.show( 0, function() {
+                               position = content.offset().top;
+                               content.css( 'margin-top', ( 45 - position ) );
+                               section.toggleClass( 'current-panel' );
+                               container.toggleClass( 'in-sub-panel' );
+                       } );
+               }
+       }
+
</ins><span class="cx">   // Initialize the accordion (currently just corner fixes)
</span><span class="cx">  accordionInit();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizemanagerphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-customize-manager.php (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-customize-manager.php     2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-includes/class-wp-customize-manager.php        2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">  public $widgets;
</span><span class="cx"> 
</span><span class="cx">  protected $settings = array();
</span><ins>+       protected $panels   = array();
</ins><span class="cx">   protected $sections = array();
</span><span class="cx">  protected $controls = array();
</span><span class="cx"> 
</span><span class="lines">@@ -315,6 +316,17 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * Get the registered panels.
+        *
+        * @since 4.0.0
+        *
+        * @return array
+        */
+       public function panels() {
+               return $this->panels;
+       }
+
+       /**
</ins><span class="cx">    * Checks if the current theme is active.
</span><span class="cx">   *
</span><span class="cx">   * @since 3.4.0
</span><span class="lines">@@ -648,6 +660,50 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * Add a customize panel.
+        *
+        * @since 4.0.0
+        *
+        * @param WP_Customize_Panel|string $id   Customize Panel object, or Panel ID.
+        * @param array                     $args Panel arguments.
+        */
+       public function add_panel( $id, $args = array() ) {
+               if ( is_a( $id, 'WP_Customize_Panel' ) ) {
+                       $panel = $id;
+               }
+               else {
+                       $panel = new WP_Customize_Panel( $this, $id, $args );
+               }
+
+               $this->panels[ $panel->id ] = $panel;
+       }
+
+       /**
+        * Retrieve a customize panel.
+        *
+        * @since 4.0.0
+        *
+        * @param string $id Panel ID.
+        * @return WP_Customize_Panel
+        */
+       public function get_panel( $id ) {
+               if ( isset( $this->panels[ $id ] ) ) {
+                       return $this->panels[ $id ];
+               }
+       }
+
+       /**
+        * Remove a customize panel.
+        *
+        * @since 4.0.0
+        *
+        * @param string $id Panel ID.
+        */
+       public function remove_panel( $id ) {
+               unset( $this->panels[ $id ] );
+       }
+
+       /**
</ins><span class="cx">    * Add a customize section.
</span><span class="cx">   *
</span><span class="cx">   * @since 3.4.0
</span><span class="lines">@@ -749,7 +805,7 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Prepare settings and sections.
</del><ins>+         * Prepare panels, sections, and controls.
</ins><span class="cx">    *
</span><span class="cx">   * For each, check if required related components exist,
</span><span class="cx">   * whether the user has the necessary capabilities,
</span><span class="lines">@@ -763,8 +819,9 @@
</span><span class="cx">          $controls = array();
</span><span class="cx"> 
</span><span class="cx">          foreach ( $this->controls as $id => $control ) {
</span><del>-                       if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() )
</del><ins>+                        if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
</ins><span class="cx">                           continue;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  $this->sections[ $control->section ]->controls[] = $control;
</span><span class="cx">                  $controls[ $id ] = $control;
</span><span class="lines">@@ -778,13 +835,39 @@
</span><span class="cx">          $sections = array();
</span><span class="cx"> 
</span><span class="cx">          foreach ( $this->sections as $section ) {
</span><del>-                       if ( ! $section->check_capabilities() || ! $section->controls )
</del><ins>+                        if ( ! $section->check_capabilities() || ! $section->controls ) {
</ins><span class="cx">                           continue;
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  usort( $section->controls, array( $this, '_cmp_priority' ) );
</span><del>-                       $sections[] = $section;
</del><ins>+
+                       if ( ! $section->panel ) {
+                               // Top-level section.
+                               $sections[] = $section;
+                       } else {
+                               // This section belongs to a panel.
+                               if ( isset( $this->panels [ $section->panel ] ) ) {
+                                       $this->panels[ $section->panel ]->sections[] = $section;
+                               }
+                       }
</ins><span class="cx">           }
</span><span class="cx">          $this->sections = $sections;
</span><ins>+
+               // Prepare panels.
+               // Reversing makes uasort sort by time added when conflicts occur.
+               $this->panels = array_reverse( $this->panels );
+               uasort( $this->panels, array( $this, '_cmp_priority' ) );
+               $panels = array();
+
+               foreach ( $this->panels as $panel ) {
+                       if ( ! $panel->check_capabilities() || ! $panel->sections ) {
+                               continue;
+                       }
+
+                       usort( $panel->sections, array( $this, '_cmp_priority' ) );
+                       $panels[] = $panel;
+               }
+               $this->panels = $panels;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizesectionphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-customize-section.php (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-customize-section.php     2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-includes/class-wp-customize-section.php        2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -38,6 +38,15 @@
</span><span class="cx">  public $priority = 10;
</span><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * Panel in which to show the section, making it a sub-section.
+        *
+        * @since 4.0.0
+        * @access public
+        * @var string
+        */
+       public $panel = '';
+
+       /**
</ins><span class="cx">    * Capability required for the section.
</span><span class="cx">   *
</span><span class="cx">   * @since 3.4.0
</span><span class="lines">@@ -162,8 +171,12 @@
</span><span class="cx">   * @since 3.4.0
</span><span class="cx">   */
</span><span class="cx">  protected function render() {
</span><ins>+               $classes = 'control-section accordion-section';
+               if ( $this->panel ) {
+                       $classes .= ' control-subsection';
+               }
</ins><span class="cx">           ?>
</span><del>-               <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="control-section accordion-section">
</del><ins>+                <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
</ins><span class="cx">                   <h3 class="accordion-section-title" tabindex="0"><?php echo esc_html( $this->title ); ?></h3>
</span><span class="cx">                  <ul class="accordion-section-content">
</span><span class="cx">                          <?php if ( ! empty( $this->description ) ) : ?>
</span><span class="lines">@@ -178,3 +191,77 @@
</span><span class="cx">          <?php
</span><span class="cx">  }
</span><span class="cx"> }
</span><ins>+
+/**
+ * Customize Panel Class.
+ *
+ * A UI container for sections, managed by the WP_Customize_Manager.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 4.0.0
+ */
+class WP_Customize_Panel extends WP_Customize_Section {
+
+       /**
+        * Customizer sections for this panel.
+        *
+        * @since 4.0.0
+        * @access public
+        * @var array
+        */
+       public $sections;
+
+       /**
+        * Constructor.
+        *
+        * Any supplied $args override class property defaults.
+        *
+        * @since 4.0.0
+        *
+        * @param WP_Customize_Manager $manager Customizer bootstrap instance.
+        * @param string               $id      An specific ID of the section.
+        * @param array                $args    Section arguments.
+        */
+       public function __construct( $manager, $id, $args = array() ) {
+               parent::__construct( $manager, $id, $args );
+
+               $this->sections = array(); // Users cannot customize the $sections array.
+
+               return $this;
+       }
+
+       /**
+        * Render the panel, and the sections that have been added to it.
+        *
+        * @since 4.0.0
+        */
+       protected function render() {
+               ?>
+               <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="control-section control-panel accordion-section">
+                       <h3 class="accordion-section-title" tabindex="0"><?php echo esc_html( $this->title ); ?></h3>
+                       <span class="control-panel-back" tabindex="0"><span class="screen-reader-text">Back to Customize</span></span>
+                       <ul class="accordion-sub-container control-panel-content">
+                               <li class="accordion-section control-section<?php if ( empty( $this->description ) ) echo ' cannot-expand'; ?>">
+                                       <div class="accordion-section-title" tabindex="0">
+                                               <span class="preview-notice"><?php
+                                                       /* translators: %s is the panel title in the Customize/Live Preview pane */
+                                                       echo sprintf( 'You are customizing %s', '<strong class="panel-title">' . esc_html( $this->title ) . '</strong>' );
+                                               ?></span>
+                                       </div>
+                                       <?php if ( ! empty( $this->description ) ) : ?>
+                                               <div class="accordion-section-content description">
+                                                       <?php echo $this->description; ?>
+                                               </div>
+                                       <?php endif; ?>
+                               </li>
+                               <?php
+                               foreach ( $this->sections as $section ) {
+                                       $section->maybe_render();
+                               }
+                               ?>
+                       </ul>
+               </li>
+               <?php
+       }
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizewidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-customize-widgets.php (28860 => 28861)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-customize-widgets.php     2014-06-26 19:07:03 UTC (rev 28860)
+++ trunk/src/wp-includes/class-wp-customize-widgets.php        2014-06-26 20:16:21 UTC (rev 28861)
</span><span class="lines">@@ -433,6 +433,11 @@
</span><span class="cx">                  $this->manager->add_setting( $setting_id, $setting_args );
</span><span class="cx">          }
</span><span class="cx"> 
</span><ins>+               $this->manager->add_panel( 'widgets', array(
+                       'title' => __( 'Widgets' ),
+                       'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
+               ) );
+
</ins><span class="cx">           foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
</span><span class="cx">                  if ( empty( $sidebar_widget_ids ) ) {
</span><span class="cx">                          $sidebar_widget_ids = array();
</span><span class="lines">@@ -458,10 +463,10 @@
</span><span class="cx">                          if ( $is_active_sidebar ) {
</span><span class="cx"> 
</span><span class="cx">                                  $section_args = array(
</span><del>-                                               /* translators: %s: sidebar name */
-                                               'title' => sprintf( __( 'Widgets: %s' ), $GLOBALS['wp_registered_sidebars'][$sidebar_id]['name'] ),
-                                               'description' => $GLOBALS['wp_registered_sidebars'][$sidebar_id]['description'],
-                                               'priority' => 1000 + array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
</del><ins>+                                                'title' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],
+                                               'description' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],
+                                               'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
+                                               'panel' => 'widgets',
</ins><span class="cx">                                   );
</span><span class="cx"> 
</span><span class="cx">                                  /**
</span></span></pre>
</div>
</div>

</body>
</html>