+/**
+ * Widget Area Customize Control Class
+ *
+ */
+class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
+ public $type = 'sidebar_widgets';
+ public $sidebar_id;
+
+ public function to_json() {
+ parent::to_json();
+ $exported_properties = array( 'sidebar_id' );
+ foreach ( $exported_properties as $key ) {
+ $this->json[ $key ] = $this->$key;
+ }
+ }
+
+ public function render_content() {
+ ?>
+ <span class="button-secondary add-new-widget" tabindex="0">
+ <?php _e( 'Add a Widget' ); ?>
+ </span>
+
+ <span class="reorder-toggle" tabindex="0">
+ <span class="reorder"><?php _ex( 'Reorder', 'Reorder widgets in Customizer' ); ?></span>
+ <span class="reorder-done"><?php _ex( 'Done', 'Cancel reordering widgets in Customizer' ); ?></span>
+ </span>
+ <?php
+ }
+
+ /**
+ * Whether the current sidebar is rendered on the page.
+ *
+ * @since 4.0.0
+ * @access public
+ *
+ * @return bool Whether sidebar is rendered.
+ */
+ public function active_callback() {
+ return $this->manager->widgets->is_sidebar_rendered( $this->sidebar_id );
+ }
+}
+
+/**
+ * Widget Form Customize Control Class
+ */
+class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
+ public $type = 'widget_form';
+ public $widget_id;
+ public $widget_id_base;
+ public $sidebar_id;
+ public $is_new = false;
+ public $width;
+ public $height;
+ public $is_wide = false;
+
+ public function to_json() {
+ parent::to_json();
+ $exported_properties = array( 'widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide' );
+ foreach ( $exported_properties as $key ) {
+ $this->json[ $key ] = $this->$key;
+ }
+ }
+
+ public function render_content() {
+ global $wp_registered_widgets;
+ require_once ABSPATH . '/wp-admin/includes/widgets.php';
+
+ $widget = $wp_registered_widgets[ $this->widget_id ];
+ if ( ! isset( $widget['params'][0] ) ) {
+ $widget['params'][0] = array();
+ }