当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Customize_Manager::controls方法代码示例

本文整理汇总了PHP中WP_Customize_Manager::controls方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::controls方法的具体用法?PHP WP_Customize_Manager::controls怎么用?PHP WP_Customize_Manager::controls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Manager的用法示例。


在下文中一共展示了WP_Customize_Manager::controls方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:BE-Webdesign,项目名称:wp-customize-widgets-plus,代码行数:38,代码来源:class-deferred-customize-widgets.php

示例2: array

 /**
  * @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));
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:17,代码来源:manager.php


注:本文中的WP_Customize_Manager::controls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。