mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@29051 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -475,7 +475,8 @@ final class WP_Customize_Manager {
|
||||
public function customize_preview_settings() {
|
||||
$settings = array(
|
||||
'values' => array(),
|
||||
'channel' => esc_js( $_POST['customize_messenger_channel'] ),
|
||||
'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
|
||||
'activeControls' => array(),
|
||||
);
|
||||
|
||||
if ( 2 == $this->nonce_tick ) {
|
||||
@@ -488,6 +489,9 @@ final class WP_Customize_Manager {
|
||||
foreach ( $this->settings as $id => $setting ) {
|
||||
$settings['values'][ $id ] = $setting->js_value();
|
||||
}
|
||||
foreach ( $this->controls as $id => $control ) {
|
||||
$settings['activeControls'][ $id ] = $control->active();
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
Reference in New Issue
Block a user