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. Built from https://develop.svn.wordpress.org/trunk@28861 git-svn-id: http://core.svn.wordpress.org/trunk@28662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -433,6 +433,11 @@ final class WP_Customize_Widgets {
|
||||
$this->manager->add_setting( $setting_id, $setting_args );
|
||||
}
|
||||
|
||||
$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).' ),
|
||||
) );
|
||||
|
||||
foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
|
||||
if ( empty( $sidebar_widget_ids ) ) {
|
||||
$sidebar_widget_ids = array();
|
||||
@@ -458,10 +463,10 @@ final class WP_Customize_Widgets {
|
||||
if ( $is_active_sidebar ) {
|
||||
|
||||
$section_args = array(
|
||||
/* 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 ) ),
|
||||
'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',
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user