WP_Customize_Manager::controls PHP Method

controls() public method

Get the registered controls.
Since: 3.4.0
public controls ( ) : array
return array
    public function controls()
    {
        return $this->controls;
    }

Usage Example

 /**
  * Temporarily remove widget settings and controls from the Manager so that
  * they won't be serialized at once in _wpCustomizeSettings. This greatly
  * reduces the peak memory usage.
  *
  * This is only relevant in WordPress versions older than 4.4-alpha-33636-src,
  * with the changes introduced in Trac #33898.
  *
  * @link https://core.trac.wordpress.org/ticket/33898
  */
 function defer_serializing_data_until_shutdown()
 {
     $this->customize_controls = array();
     $controls = $this->manager->controls();
     foreach ($controls as $control) {
         if ($control instanceof \WP_Widget_Form_Customize_Control || $control instanceof \WP_Widget_Area_Customize_Control) {
             $this->customize_controls[$control->id] = $control;
             $this->manager->remove_control($control->id);
         }
     }
     /*
      * Note: There is currently a Core dependency issue where the control for WP_Widget_Area_Customize_Control
      * must be processed after the control for WP_Widget_Form_Customize_Control, as otherwise the sidebar
      * does not initialize properly (specifically in regards to the reorder-toggle button. So this is why
      * we are including the WP_Widget_Area_Customize_Controls among those which are deferred.
      */
     $this->customize_settings = array();
     $settings = $this->manager->settings();
     foreach ($settings as $setting) {
         if (preg_match('/^(widget_.+?\\[\\d+\\]|sidebars_widgets\\[.+?\\])$/', $setting->id)) {
             $this->customize_settings[$setting->id] = $setting;
             $this->manager->remove_setting($setting->id);
         }
     }
     // We have to use shutdown because no action is triggered after _wpCustomizeSettings is written.
     add_action('shutdown', array($this, 'export_data_with_peak_memory_usage_minimized'), 10);
     add_action('shutdown', array($this, 'fixup_widget_control_params_for_dom_deferral'), 11);
 }
All Usage Examples Of WP_Customize_Manager::controls
WP_Customize_Manager