Create WP_Customize_Control to separate the process of rendering a control from fetching, previewing, and saving its values. see #19910.

Many-to-many mapping between settings and controls.
* Settings and controls have been separated in both the PHP (WP_Customize_Setting, WP_Customize_Control) and the JS (wp.customize.Setting, wp.customize.Control).
* While most settings are tied to a single control, some require multiple controls. The 'header_textcolor' control is a good example: to hide the header text, header_textcolor is set to 'blank'.

Add 'Display Header Text' control.

A handful of miscellaneous bugfixes along the way.

Notes:
* Controls should be separated out a bit more; juggling type-specific arguments in the switch statement is rather inelegant.
* Page dropdowns are currently inactive and need to be re-linked.

git-svn-id: https://develop.svn.wordpress.org/trunk@20295 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-03-28 04:14:09 +00:00
parent 4337bd15e7
commit 2ca07cdf2a
8 changed files with 653 additions and 386 deletions

View File

@@ -15,7 +15,7 @@ class WP_Customize_Section {
public $theme_supports = '';
public $title = '';
public $description = '';
public $settings;
public $controls;
/**
* Constructor.
@@ -35,7 +35,7 @@ class WP_Customize_Section {
$this->manager = $manager;
$this->id = $id;
$this->settings = array(); // Users cannot customize the $settings array.
$this->controls = array(); // Users cannot customize the $controls array.
return $this;
}
@@ -84,8 +84,8 @@ class WP_Customize_Section {
<h3 class="customize-section-title" title="<?php echo esc_attr( $this->description ); ?>"><?php echo esc_html( $this->title ); ?></h3>
<ul class="customize-section-content">
<?php
foreach ( $this->settings as $setting )
$setting->maybe_render();
foreach ( $this->controls as $control )
$control->maybe_render();
?>
</ul>
</li>