WP_Customize_Section::json() WordPress Method
The WP_Customize_Section::json() method is used to return a JSON representation of a Customizer section. This is useful for creating a Customizer section programmatically.
WP_Customize_Section::json() #
Gather the parameters passed to client JavaScript via JSON.
Return
(array) The array to be exported to the client as JSON.
Source
File: wp-includes/class-wp-customize-section.php
public function json() { $array = wp_array_slice_assoc( (array) $this, array( 'id', 'description', 'priority', 'panel', 'type', 'description_hidden' ) ); $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); $array['content'] = $this->get_content(); $array['active'] = $this->active(); $array['instanceNumber'] = $this->instance_number; if ( $this->panel ) { /* translators: ▸ is the unicode right-pointing triangle. %s: Section title in the Customizer. */ $array['customizeAction'] = sprintf( __( 'Customizing ▸ %s' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); } else { $array['customizeAction'] = __( 'Customizing' ); } return $array; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.1.0 | Introduced. |