WP_Customize_Control::to_json() WordPress Method
The WP_Customize_Control::to_json() method is used to convert the data for a customizer control into a JSON object. This is used to send the data to the client-side where it can be used to update the control.
WP_Customize_Control::to_json() #
Refresh the parameters passed to the JavaScript via JSON.
Source
File: wp-includes/class-wp-customize-control.php
public function to_json() { $this->json['settings'] = array(); foreach ( $this->settings as $key => $setting ) { $this->json['settings'][ $key ] = $setting->id; } $this->json['type'] = $this->type; $this->json['priority'] = $this->priority; $this->json['active'] = $this->active(); $this->json['section'] = $this->section; $this->json['content'] = $this->get_content(); $this->json['label'] = $this->label; $this->json['description'] = $this->description; $this->json['instanceNumber'] = $this->instance_number; if ( 'dropdown-pages' === $this->type ) { $this->json['allow_addition'] = $this->allow_addition; } }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |