You are here

public function ContainerAwarePluginManager::getDefinitions in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/Plugin/ContainerAwarePluginManager.php \Drupal\service_container\Plugin\ContainerAwarePluginManager::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DiscoveryInterface::getDefinitions

File

src/Plugin/ContainerAwarePluginManager.php, line 39
Contains \Drupal\service_container\Plugin\ContainerAwarePluginManager

Class

ContainerAwarePluginManager
Base class for plugin managers.

Namespace

Drupal\service_container\Plugin

Code

public function getDefinitions() {
  $definitions = $this->container
    ->getDefinitions();
  $prefix = $this->servicePrefix;

  // Note: ARRAY_FILTER_USE_BOTH is not supported in HHVM and PHP 5.4.
  $keys = array_filter(array_keys($definitions), function ($key) use ($prefix) {
    return strpos($key, $prefix) === 0;
  });
  return array_intersect_key($definitions, array_flip($keys));
}