controls() 공개 메소드

Get the registered controls.
부터: 3.4.0
public controls ( ) : array
리턴 array
 /**
  * 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);
 }
 /**
  * @ticket 37128
  */
 function test_prepare_controls_wp_list_sort_controls()
 {
     wp_set_current_user(self::$admin_user_id);
     $controls = array('foo' => 2, 'bar' => 4, 'foobar' => 3, 'key' => 1);
     $controls_sorted = array('key', 'foo', 'foobar', 'bar');
     $this->manager->add_section('foosection', array());
     foreach ($controls as $control_id => $priority) {
         $this->manager->add_setting($control_id);
         $this->manager->add_control($control_id, array('priority' => $priority, 'section' => 'foosection'));
     }
     $this->manager->prepare_controls();
     $result = $this->manager->controls();
     $this->assertEquals($controls_sorted, array_keys($result));
 }