Customizer: Add panel/section type as CSS class to the HTML container.

see #28709.

git-svn-id: https://develop.svn.wordpress.org/trunk@30714 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2014-12-02 22:15:33 +00:00
parent c0b15e6b6d
commit 104b31ae54
3 changed files with 13 additions and 6 deletions

View File

@ -7,11 +7,11 @@
* preview loads and we know whether the sidebars are used in the template. * preview loads and we know whether the sidebars are used in the template.
*/ */
.control-section[id^="accordion-section-sidebar-widgets-"], .control-section.control-section-sidebar,
.customize-control-sidebar_widgets label, .customize-control-sidebar_widgets label,
.customize-control-sidebar_widgets .hide-if-js { .customize-control-sidebar_widgets .hide-if-js {
/* The link in .customize-control-sidebar_widgets .hide-if-js will fail if it ever gets used. */ /* The link in .customize-control-sidebar_widgets .hide-if-js will fail if it ever gets used. */
display:none; display: none;
} }
.customize-control-widget_form .widget-top { .customize-control-widget_form .widget-top {

View File

@ -103,11 +103,13 @@ class WP_Customize_Panel {
public $sections; public $sections;
/** /**
* Type of this panel.
*
* @since 4.1.0 * @since 4.1.0
* @access public * @access public
* @var string * @var string
*/ */
public $type; public $type = 'default';
/** /**
* Active callback. * Active callback.
@ -285,8 +287,9 @@ class WP_Customize_Panel {
* @access protected * @access protected
*/ */
protected function render() { protected function render() {
$classes = 'accordion-section control-section control-panel control-panel-' . $this->type;
?> ?>
<li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="control-section control-panel accordion-section"> <li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
<h3 class="accordion-section-title" tabindex="0"> <h3 class="accordion-section-title" tabindex="0">
<?php echo esc_html( $this->title ); ?> <?php echo esc_html( $this->title ); ?>
<span class="screen-reader-text"><?php _e( 'Press return or enter to open this panel' ); ?></span> <span class="screen-reader-text"><?php _e( 'Press return or enter to open this panel' ); ?></span>

View File

@ -112,11 +112,13 @@ class WP_Customize_Section {
public $controls; public $controls;
/** /**
* Type of this section.
*
* @since 4.1.0 * @since 4.1.0
* @access public * @access public
* @var string * @var string
*/ */
public $type; public $type = 'default';
/** /**
* Active callback. * Active callback.
@ -292,7 +294,7 @@ class WP_Customize_Section {
* @since 3.4.0 * @since 3.4.0
*/ */
protected function render() { protected function render() {
$classes = 'control-section accordion-section'; $classes = 'accordion-section control-section control-section-' . $this->type;
?> ?>
<li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>"> <li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
<h3 class="accordion-section-title" tabindex="0"> <h3 class="accordion-section-title" tabindex="0">
@ -324,6 +326,8 @@ class WP_Customize_Section {
class WP_Customize_Sidebar_Section extends WP_Customize_Section { class WP_Customize_Sidebar_Section extends WP_Customize_Section {
/** /**
* Type of this section.
*
* @since 4.1.0 * @since 4.1.0
* @access public * @access public
* @var string * @var string