mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections. * Introduce API to expand and focus a control, section or panel. * Allow deep-linking to panels, sections, and controls inside of the Customizer. * Clean up `accordion.js`, removing all Customizer-specific logic. * Add initial unit tests for `wp.customize.Class` in `customize-base.js`. https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API. props westonruter, celloexpressions, ryankienstra. see #28032, #28579, #28580, #28650, #28709, #29758. fixes #29529. git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -74,6 +74,7 @@ class WP_Customize_Control {
|
||||
public $input_attrs = array();
|
||||
|
||||
/**
|
||||
* @deprecated It is better to just call the json() method
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
@@ -218,9 +219,24 @@ class WP_Customize_Control {
|
||||
}
|
||||
|
||||
$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['active'] = $this->active();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data to export to the client via JSON.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function json() {
|
||||
$this->to_json();
|
||||
return $this->json;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,6 +259,21 @@ class WP_Customize_Control {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the control's content for insertion into the Customizer pane.
|
||||
*
|
||||
* @since 4.1.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public final function get_content() {
|
||||
ob_start();
|
||||
$this->maybe_render();
|
||||
$template = trim( ob_get_contents() );
|
||||
ob_end_clean();
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check capabilities and render the control.
|
||||
*
|
||||
@@ -1073,6 +1104,7 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
||||
/**
|
||||
* Widget Area Customize Control Class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
|
||||
public $type = 'sidebar_widgets';
|
||||
@@ -1114,6 +1146,8 @@ class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* Widget Form Customize Control Class
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
|
||||
public $type = 'widget_form';
|
||||
|
||||
Reference in New Issue
Block a user