Make WordPress Core


Ignore:
Timestamp:
03/28/2012 04:14:09 AM (13 years ago)
Author:
koopersmith
Message:

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.
File:
1 edited

Legend:

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

    r20260 r20295  
    1616    public $title          = '';
    1717    public $description    = '';
    18     public $settings;
     18    public $controls;
    1919
    2020    /**
     
    3636        $this->id = $id;
    3737
    38         $this->settings = array(); // Users cannot customize the $settings array.
     38        $this->controls = array(); // Users cannot customize the $controls array.
    3939
    4040        return $this;
     
    8585            <ul class="customize-section-content">
    8686                <?php
    87                 foreach ( $this->settings as $setting )
    88                     $setting->maybe_render();
     87                foreach ( $this->controls as $control )
     88                    $control->maybe_render();
    8989                ?>
    9090            </ul>
Note: See TracChangeset for help on using the changeset viewer.