Make WordPress Core


Ignore:
Timestamp:
06/26/2014 08:16:21 PM (10 years ago)
Author:
ocean90
Message:

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 #27406.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src

    • Property svn:ignore
      •  

        old new  
        11.wp-tests-version
        22.htaccess
         3web-store-experiences
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r28143 r28861  
    434434        }
    435435
     436        $this->manager->add_panel( 'widgets', array(
     437            'title' => __( 'Widgets' ),
     438            'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
     439        ) );
     440
    436441        foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
    437442            if ( empty( $sidebar_widget_ids ) ) {
     
    459464
    460465                    $section_args = array(
    461                         /* translators: %s: sidebar name */
    462                         'title' => sprintf( __( 'Widgets: %s' ), $GLOBALS['wp_registered_sidebars'][$sidebar_id]['name'] ),
    463                         'description' => $GLOBALS['wp_registered_sidebars'][$sidebar_id]['description'],
    464                         'priority' => 1000 + array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
     466                        'title' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],
     467                        'description' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],
     468                        'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
     469                        'panel' => 'widgets',
    465470                    );
    466471
Note: See TracChangeset for help on using the changeset viewer.