Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Views.php \Drupal\views\Views::getPluginTypes()
  2. 9 core/modules/views/src/Views.php \Drupal\views\Views::getPluginTypes()

Returns a list of plugin types.

Parameters

string $type: (optional) filter the list of plugins by type. Available options are 'plugin' or 'handler'.

Return value

array An array of plugin types.

File

core/modules/views/src/Views.php, line 513

Class

Views
Static service container wrapper for views.

Namespace

Drupal\views

Code

public static function getPluginTypes($type = NULL) {
  if ($type === NULL) {
    return array_keys(static::$plugins);
  }
  if (!in_array($type, [
    'plugin',
    'handler',
  ])) {
    throw new \Exception('Invalid plugin type used. Valid types are "plugin" or "handler".');
  }
  return array_keys(array_filter(static::$plugins, function ($plugin_type) use ($type) {
    return $plugin_type == $type;
  }));
}