WordPress.org

Make WordPress Core

Changeset 20585


Ignore:
Timestamp:
04/25/2012 04:04:51 PM (7 years ago)
Author:
koopersmith
Message:

Theme Customizer: For clarity, wp.customize.Setting.method to wp.customize.Setting.transport. Add WP_Customize_Setting->transport to allow setting the transport method via PHP. see #19910.

Location:
trunk/wp-includes
Files:
4 edited

Legend:

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

    r20300 r20585  
    1717    public $default           = '';
    1818    public $sanitize_callback = '';
     19    public $transport         = 'refresh';
    1920
    2021    protected $id_data = array();
  • trunk/wp-includes/class-wp-customize.php

    r20584 r20585  
    581581            'sanitize_callback' => 'sanitize_hexcolor',
    582582            'theme_supports'    => 'custom-background',
     583            'transport'         => 'postMessage',
    583584        ) );
    584585
  • trunk/wp-includes/customize-controls.php

    r20496 r20585  
    105105    foreach ( $this->settings as $id => $setting ) {
    106106        $settings['settings'][ $id ] = array(
    107             'value'   => $setting->value(),
     107            'value'     => $setting->value(),
     108            'transport' => $setting->transport,
    108109        );
    109110    }
  • trunk/wp-includes/js/customize-controls.dev.js

    r20545 r20585  
    55     * @param options
    66     * - previewer - The Previewer instance to sync with.
    7      * - method    - The method to use for previewing. Supports 'refresh' and 'postMessage'.
     7     * - transport - The transport to use for previewing. Supports 'refresh' and 'postMessage'.
    88     */
    99    api.Setting = api.Value.extend({
     
    1414
    1515            this.id = id;
    16             this.method = this.method || 'refresh';
     16            this.transport = this.transport || 'refresh';
    1717
    1818            element = $( '<input />', {
     
    2929        },
    3030        preview: function() {
    31             switch ( this.method ) {
     31            switch ( this.transport ) {
    3232                case 'refresh':
    3333                    return this.previewer.refresh();
     
    404404        $.each( api.settings.settings, function( id, data ) {
    405405            api.set( id, id, data.value, {
     406                transport: data.transport,
    406407                previewer: previewer
    407408            } );
     
    433434            body.toggleClass( 'collapsed' );
    434435            event.preventDefault();
    435         });
    436 
    437         // Background color uses postMessage by default
    438         api( 'background_color', function( setting ) {
    439             setting.method = 'postMessage';
    440436        });
    441437
Note: See TracChangeset for help on using the changeset viewer.