function views_plugin_list

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.
1 call to views_plugin_list()
views_ui_plugin_list in drupal/core/modules/views/views_ui/admin.inc
Lists all plugins and what enabled Views use them.

File

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

Code

function views_plugin_list() {
  $plugin_data = views_get_plugin_definitions();
  $plugins = array();
  foreach (views_get_enabled_views() as $view) {
    foreach ($view
      ->get('display') as $display_id => $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] = array(
            'type' => $type,
            'title' => check_plain($info[$name]['title']),
            'module' => check_plain($info[$name]['module']),
            'views' => array(),
          );
        }

        // Add this view to the list for this plugin.
        $plugins[$key]['views'][$view
          ->get('name')] = $view
          ->get('name');
      }
    }
  }
  return $plugins;
}