Make WordPress Core


Ignore:
Timestamp:
07/09/2014 11:57:29 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Customizer: Introduce WP_Customize_Control::active() method to determine whether the control is relevant to the current context (i.e. to the current URL being previewed).

Control can indicate its active state by a subclass overriding the 'active_callback' method, by supplying a callable 'active_callback' argument into the control's constructor, or by filtering 'customize_control_active'.

props westonruter.
see #27993.

File:
1 edited

Legend:

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

    r28970 r29051  
    476476        $settings = array(
    477477            'values'  => array(),
    478             'channel' => esc_js( $_POST['customize_messenger_channel'] ),
     478            'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
     479            'activeControls' => array(),
    479480        );
    480481
     
    488489        foreach ( $this->settings as $id => $setting ) {
    489490            $settings['values'][ $id ] = $setting->js_value();
     491        }
     492        foreach ( $this->controls as $id => $control ) {
     493            $settings['activeControls'][ $id ] = $control->active();
    490494        }
    491495
Note: See TracChangeset for help on using the changeset viewer.