You are here

function views_fetch_plugin_names in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \views_fetch_plugin_names()
  2. 6.2 includes/admin.inc \views_fetch_plugin_names()
  3. 7.3 views.module \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'.

6 calls to views_fetch_plugin_names()
DisplayPluginBase::buildOptionsForm in lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Provide the default form for setting options.
Feed::init in lib/Drupal/views/Plugin/views/display/Feed.php
views_ui_admin_settings_advanced in views_ui/admin.inc
Form builder for the advanced admin settings page.
ViewUI::renderDisplayTop in views_ui/lib/Drupal/views_ui/ViewUI.php
Render the top of the display so it can be updated during ajax operations.
WizardPluginBase::build_form in lib/Drupal/views/Plugin/views/wizard/WizardPluginBase.php
Implements Drupal\views\Plugin\views\wizard\WizardInterface::build_form().

... See full list

File

./views.module, line 1360
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
  $definitions = views_get_plugin_definitions($type);
  $plugins = array();
  foreach ($definitions as $id => $plugin) {

    // Skip plugins that don't conform to our key.
    if ($key && (empty($plugin['type']) || $plugin['type'] != $key)) {
      continue;
    }

    // @todo While Views is providing on behalf of core modules, check to see
    //   if they are enabled or not.
    if (isset($plugin['module']) && !module_exists($plugin['module'])) {
      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;
  }

  // fall-through
  return array();
}