wp/wp-includes/customize/class-wp-widget-form-customize-control.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    13  * @since 3.9.0
    13  * @since 3.9.0
    14  *
    14  *
    15  * @see WP_Customize_Control
    15  * @see WP_Customize_Control
    16  */
    16  */
    17 class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
    17 class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
       
    18 	/**
       
    19 	 * Customize control type.
       
    20 	 *
       
    21 	 * @since 3.9.0
       
    22 	 * @var string
       
    23 	 */
    18 	public $type = 'widget_form';
    24 	public $type = 'widget_form';
       
    25 
       
    26 	/**
       
    27 	 * Widget ID.
       
    28 	 *
       
    29 	 * @since 3.9.0
       
    30 	 * @var string
       
    31 	 */
    19 	public $widget_id;
    32 	public $widget_id;
       
    33 
       
    34 	/**
       
    35 	 * Widget ID base.
       
    36 	 *
       
    37 	 * @since 3.9.0
       
    38 	 * @var string
       
    39 	 */
    20 	public $widget_id_base;
    40 	public $widget_id_base;
       
    41 
       
    42 	/**
       
    43 	 * Sidebar ID.
       
    44 	 *
       
    45 	 * @since 3.9.0
       
    46 	 * @var string
       
    47 	 */
    21 	public $sidebar_id;
    48 	public $sidebar_id;
       
    49 
       
    50 	/**
       
    51 	 * Widget status.
       
    52 	 *
       
    53 	 * @since 3.9.0
       
    54 	 * @var bool True if new, false otherwise. Default false.
       
    55 	 */
    22 	public $is_new = false;
    56 	public $is_new = false;
       
    57 
       
    58 	/**
       
    59 	 * Widget width.
       
    60 	 *
       
    61 	 * @since 3.9.0
       
    62 	 * @var int
       
    63 	 */
    23 	public $width;
    64 	public $width;
       
    65 
       
    66 	/**
       
    67 	 * Widget height.
       
    68 	 *
       
    69 	 * @since 3.9.0
       
    70 	 * @var int
       
    71 	 */
    24 	public $height;
    72 	public $height;
       
    73 
       
    74 	/**
       
    75 	 * Widget mode.
       
    76 	 *
       
    77 	 * @since 3.9.0
       
    78 	 * @var bool True if wide, false otherwise. Default false.
       
    79 	 */
    25 	public $is_wide = false;
    80 	public $is_wide = false;
    26 
    81 
    27 	/**
    82 	/**
    28 	 * Gather control params for exporting to JavaScript.
    83 	 * Gather control params for exporting to JavaScript.
    29 	 *
    84 	 *
    39 		foreach ( $exported_properties as $key ) {
    94 		foreach ( $exported_properties as $key ) {
    40 			$this->json[ $key ] = $this->$key;
    95 			$this->json[ $key ] = $this->$key;
    41 		}
    96 		}
    42 
    97 
    43 		// Get the widget_control and widget_content.
    98 		// Get the widget_control and widget_content.
    44 		require_once ABSPATH . '/wp-admin/includes/widgets.php';
    99 		require_once ABSPATH . 'wp-admin/includes/widgets.php';
    45 
   100 
    46 		$widget = $wp_registered_widgets[ $this->widget_id ];
   101 		$widget = $wp_registered_widgets[ $this->widget_id ];
    47 		if ( ! isset( $widget['params'][0] ) ) {
   102 		if ( ! isset( $widget['params'][0] ) ) {
    48 			$widget['params'][0] = array();
   103 			$widget['params'][0] = array();
    49 		}
   104 		}
    50 
   105 
    51 		$args = array(
   106 		$args = array(
    52 			'widget_id' => $widget['id'],
   107 			'widget_id'   => $widget['id'],
    53 			'widget_name' => $widget['name'],
   108 			'widget_name' => $widget['name'],
    54 		);
   109 		);
    55 
   110 
    56 		$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
   111 		$args                 = wp_list_widget_controls_dynamic_sidebar(
       
   112 			array(
       
   113 				0 => $args,
       
   114 				1 => $widget['params'][0],
       
   115 			)
       
   116 		);
    57 		$widget_control_parts = $this->manager->widgets->get_widget_control_parts( $args );
   117 		$widget_control_parts = $this->manager->widgets->get_widget_control_parts( $args );
    58 
   118 
    59 		$this->json['widget_control'] = $widget_control_parts['control'];
   119 		$this->json['widget_control'] = $widget_control_parts['control'];
    60 		$this->json['widget_content'] = $widget_control_parts['content'];
   120 		$this->json['widget_content'] = $widget_control_parts['content'];
    61 	}
   121 	}