當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。