public static function Views::pluginList in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/src/Views.php \Drupal\views\Views::pluginList()
- 10 core/modules/views/src/Views.php \Drupal\views\Views::pluginList()
Returns a list of plugins and metadata about them.
Return value
array An array keyed by PLUGIN_TYPE:PLUGIN_NAME, like 'display:page' or 'pager:full', containing an array with the following keys:
- title: The plugin's title.
- type: The plugin type.
- module: The module providing the plugin.
- views: An array of enabled Views that are currently using this plugin, keyed by machine name.
2 calls to Views::pluginList()
- ModuleTest::testViewsPluginList in core/
modules/ views/ tests/ src/ Kernel/ ModuleTest.php - Tests the \Drupal\views\Views::pluginList() method.
- ViewsUIController::reportPlugins in core/
modules/ views_ui/ src/ Controller/ ViewsUIController.php - Lists all plugins and what enabled Views use them.
File
- core/
modules/ views/ src/ Views.php, line 371
Class
- Views
- Static service container wrapper for views.
Namespace
Drupal\viewsCode
public static function pluginList() {
$plugin_data = static::getPluginDefinitions();
$plugins = [];
foreach (static::getEnabledViews() as $view) {
foreach ($view
->get('display') as $display) {
foreach ($plugin_data as $type => $info) {
if ($type == 'display' && isset($display['display_plugin'])) {
$name = $display['display_plugin'];
}
elseif (isset($display['display_options']["{$type}_plugin"])) {
$name = $display['display_options']["{$type}_plugin"];
}
elseif (isset($display['display_options'][$type]['type'])) {
$name = $display['display_options'][$type]['type'];
}
else {
continue;
}
// Key first by the plugin type, then the name.
$key = $type . ':' . $name;
// Add info for this plugin.
if (!isset($plugins[$key])) {
$plugins[$key] = [
'type' => $type,
'title' => $info[$name]['title'],
'provider' => $info[$name]['provider'],
'views' => [],
];
}
// Add this view to the list for this plugin.
$plugins[$key]['views'][$view
->id()] = $view
->id();
}
}
}
return $plugins;
}