Make WordPress Core

Changeset 29487


Ignore:
Timestamp:
08/14/2014 04:39:42 AM (10 years ago)
Author:
nacin
Message:

Separate WP_Customize_Panel from WP_Customize_Section.

props celloexpressions.
fixes #29197.

Location:
trunk/src/wp-includes
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r29454 r29487  
    6767    public function __construct() {
    6868        require( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
     69        require( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
    6970        require( ABSPATH . WPINC . '/class-wp-customize-section.php' );
    7071        require( ABSPATH . WPINC . '/class-wp-customize-control.php' );
  • trunk/src/wp-includes/class-wp-customize-section.php

    r29482 r29487  
    195195    }
    196196}
    197 
    198 /**
    199  * Customize Panel Class.
    200  *
    201  * A UI container for sections, managed by the WP_Customize_Manager.
    202  *
    203  * @package WordPress
    204  * @subpackage Customize
    205  * @since 4.0.0
    206  */
    207 class WP_Customize_Panel extends WP_Customize_Section {
    208 
    209     /**
    210      * Customizer sections for this panel.
    211      *
    212      * @since 4.0.0
    213      * @access public
    214      * @var array
    215      */
    216     public $sections;
    217 
    218     /**
    219      * Constructor.
    220      *
    221      * Any supplied $args override class property defaults.
    222      *
    223      * @since 4.0.0
    224      * @access public
    225      *
    226      * @param WP_Customize_Manager $manager Customizer bootstrap instance.
    227      * @param string               $id      An specific ID of the section.
    228      * @param array                $args    Optional. Section arguments. Default empty array.
    229      */
    230     public function __construct( $manager, $id, $args = array() ) {
    231         parent::__construct( $manager, $id, $args );
    232 
    233         $this->sections = array(); // Users cannot customize the $sections array.
    234 
    235         return $this;
    236     }
    237 
    238     /**
    239      * Render the panel, and the sections that have been added to it.
    240      *
    241      * @since 4.0.0
    242      * @access protected
    243      */
    244     protected function render() {
    245         ?>
    246         <li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="control-section control-panel accordion-section">
    247             <h3 class="accordion-section-title" tabindex="0">
    248                 <?php echo esc_html( $this->title ); ?>
    249                 <span class="screen-reader-text"><?php _e( 'Press return or enter to open panel' ); ?></span>
    250             </h3>
    251             <span class="control-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></span>
    252             <ul class="accordion-sub-container control-panel-content">
    253                 <li class="accordion-section control-section<?php if ( empty( $this->description ) ) echo ' cannot-expand'; ?>">
    254                     <div class="accordion-section-title" tabindex="0">
    255                         <span class="preview-notice"><?php
    256                             /* translators: %s is the site/panel title in the Customize pane */
    257                             echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title">' . esc_html( $this->title ) . '</strong>' );
    258                         ?></span>
    259                     </div>
    260                     <?php if ( ! empty( $this->description ) ) : ?>
    261                         <div class="accordion-section-content description">
    262                             <?php echo $this->description; ?>
    263                         </div>
    264                     <?php endif; ?>
    265                 </li>
    266                 <?php
    267                 foreach ( $this->sections as $section ) {
    268                     $section->maybe_render();
    269                 }
    270                 ?>
    271             </ul>
    272         </li>
    273         <?php
    274     }
    275 }
Note: See TracChangeset for help on using the changeset viewer.