WP_Widget_Form_Customize_Control

Widget Form Customize Control class.

Defined (1)

The class is defined in the following location(s).

/wp-includes/customize/class-wp-widget-form-customize-control.php  
  1. class WP_Widget_Form_Customize_Control extends WP_Customize_Control { 
  2. public $type = 'widget_form'; 
  3. public $widget_id; 
  4. public $widget_id_base; 
  5. public $sidebar_id; 
  6. public $is_new = false; 
  7. public $width; 
  8. public $height; 
  9. public $is_wide = false; 
  10.  
  11. /** 
  12. * Gather control params for exporting to JavaScript. 
  13. * @global array $wp_registered_widgets 
  14. */ 
  15. public function to_json() { 
  16. global $wp_registered_widgets; 
  17.  
  18. parent::to_json(); 
  19. $exported_properties = array( 'widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide' ); 
  20. foreach ( $exported_properties as $key ) { 
  21. $this->json[ $key ] = $this->$key; 
  22.  
  23. // Get the widget_control and widget_content. 
  24. require_once ABSPATH . '/wp-admin/includes/widgets.php'; 
  25.  
  26. $widget = $wp_registered_widgets[ $this->widget_id ]; 
  27. if ( ! isset( $widget['params'][0] ) ) { 
  28. $widget['params'][0] = array(); 
  29.  
  30. $args = array( 
  31. 'widget_id' => $widget['id'],  
  32. 'widget_name' => $widget['name'],  
  33. ); 
  34.  
  35. $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) ); 
  36. $widget_control_parts = $this->manager->widgets->get_widget_control_parts( $args ); 
  37.  
  38. $this->json['widget_control'] = $widget_control_parts['control']; 
  39. $this->json['widget_content'] = $widget_control_parts['content']; 
  40.  
  41. /** 
  42. * Override render_content to be no-op since content is exported via to_json for deferred embedding. 
  43. */ 
  44. public function render_content() {} 
  45.  
  46. /** 
  47. * Whether the current widget is rendered on the page. 
  48. * @since 4.0.0 
  49. * @access public 
  50. * @return bool Whether the widget is rendered. 
  51. */ 
  52. public function active_callback() { 
  53. return $this->manager->widgets->is_widget_rendered( $this->widget_id );