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


PHP Views::pluginList方法代码示例

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


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

示例1: pluginList

 /**
  * @param \Drupal\Console\Style\DrupalStyle $io
  * @param $tag
  * @param $status
  */
 protected function pluginList(DrupalStyle $io, $type)
 {
     $plugins = Views::pluginList();
     $rows = [];
     foreach ($plugins as &$plugin) {
         if ($type && $plugin['type'] != $type) {
             continue;
         }
         $views = [];
         // Link each view name to the view itself.
         foreach ($plugin['views'] as $plugin_name => $view) {
             $views[] = $view;
         }
         $rows[] = [$plugin['type'], $plugin['title'], $plugin['provider'], implode(",", $views)];
     }
     // Sort rows by field name.
     ksort($rows);
     $tableHeader = [$this->trans('commands.views.plugins.debug.messages.type'), $this->trans('commands.views.plugins.debug.messages.name'), $this->trans('commands.views.plugins.debug.messages.provider'), $this->trans('commands.views.plugins.debug.messages.views')];
     $io->table($tableHeader, $rows, 'compact');
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:25,代码来源:PluginsDebugCommand.php

示例2: reportPlugins

 /**
  * Lists all plugins and what enabled Views use them.
  *
  * @return array
  *   The Views plugins report page.
  */
 public function reportPlugins()
 {
     $rows = Views::pluginList();
     foreach ($rows as &$row) {
         $views = [];
         // Link each view name to the view itself.
         foreach ($row['views'] as $row_name => $view) {
             $views[] = $this->l($view, new Url('entity.view.edit_form', array('view' => $view)));
         }
         unset($row['views']);
         $row['views']['data'] = ['#theme' => 'item_list', '#items' => $views, '#context' => ['list_style' => 'comma-list']];
     }
     // Sort rows by field name.
     ksort($rows);
     return array('#type' => 'table', '#header' => array(t('Type'), t('Name'), t('Provided by'), t('Used in')), '#rows' => $rows, '#empty' => t('There are no enabled views.'));
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:22,代码来源:ViewsUIController.php

示例3: reportPlugins

 /**
  * Lists all plugins and what enabled Views use them.
  *
  * @return array
  *   The Views plugins report page.
  */
 public function reportPlugins()
 {
     $rows = Views::pluginList();
     foreach ($rows as &$row) {
         // Link each view name to the view itself.
         foreach ($row['views'] as $row_name => $view) {
             $row['views'][$row_name] = $this->l($view, new Url('entity.view.edit_form', array('view' => $view)));
         }
         $row['views'] = SafeMarkup::set(implode(', ', $row['views']));
     }
     // Sort rows by field name.
     ksort($rows);
     return array('#type' => 'table', '#header' => array(t('Type'), t('Name'), t('Provided by'), t('Used in')), '#rows' => $rows, '#empty' => t('There are no enabled views.'));
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:20,代码来源:ViewsUIController.php

示例4: testViewsPluginList

 /**
  * Tests the \Drupal\views\Views::pluginList() method.
  */
 public function testViewsPluginList()
 {
     $plugin_list = Views::pluginList();
     // Only plugins used by 'test_view' should be in the plugin list.
     foreach (array('display:default', 'pager:none') as $key) {
         list($plugin_type, $plugin_id) = explode(':', $key);
         $plugin_def = $this->container->get("plugin.manager.views.{$plugin_type}")->getDefinition($plugin_id);
         $this->assertTrue(isset($plugin_list[$key]), SafeMarkup::format('The expected @key plugin list key was found.', array('@key' => $key)));
         $plugin_details = $plugin_list[$key];
         $this->assertEqual($plugin_details['type'], $plugin_type, 'The expected plugin type was found.');
         $this->assertEqual($plugin_details['title'], $plugin_def['title'], 'The expected plugin title was found.');
         $this->assertEqual($plugin_details['provider'], $plugin_def['provider'], 'The expected plugin provider was found.');
         $this->assertTrue(in_array('test_view', $plugin_details['views']), 'The test_view View was found in the list of views using this plugin.');
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:18,代码来源:ModuleTest.php


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