function views_fetch_plugin_names

Fetch a list of all base tables available

Parameters

$type: Either 'display', 'style' or 'row'

$key: For style plugins, this is an optional type to restrict to. May be 'normal', 'summary', 'feed' or others based on the neds of the display.

$base: An array of possible base tables.

Return value

A keyed array of in the form of 'base_table' => 'Description'.

8 calls to views_fetch_plugin_names()
AdvancedSettingsForm::buildForm in drupal/core/modules/views_ui/lib/Drupal/views_ui/Form/AdvancedSettingsForm.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
DisplayPluginBase::buildOptionsForm in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Provide the default form for setting options.
Feed::initDisplay in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay().
ModuleTest::testViewsFetchPluginNames in drupal/core/modules/views/lib/Drupal/views/Tests/ModuleTest.php
Tests the views_fetch_plugin_names() function.
ViewEditFormController::getDisplayDetails in drupal/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php
Helper function to get the display details section of the edit UI.

... See full list

File

drupal/core/modules/views/views.module, line 915
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
  $definitions = Views::pluginManager($type)
    ->getDefinitions();
  $plugins = array();
  foreach ($definitions as $id => $plugin) {

    // Skip plugins that don't conform to our key, if they have one.
    if ($key && isset($plugin['display_types']) && !in_array($key, $plugin['display_types'])) {
      continue;
    }
    if (empty($plugin['no_ui']) && (empty($base) || empty($plugin['base']) || array_intersect($base, $plugin['base']))) {
      $plugins[$id] = $plugin['title'];
    }
  }
  if (!empty($plugins)) {
    asort($plugins);
    return $plugins;
  }
  return $plugins;
}