You are here

public function ServiceContainerServiceProvider::registerAnnotatedPluginTypes in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider::registerAnnotatedPluginTypes()

Automatically register all annotated Plugins.

Parameters

array $container_definition: The container definition to process.

array $definition: The parameter definition.

1 call to ServiceContainerServiceProvider::registerAnnotatedPluginTypes()
ServiceContainerServiceProvider::alterContainerDefinition in src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php
Allows to alter the container definition.

File

src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php, line 245
Contains \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider

Class

ServiceContainerServiceProvider
Provides render cache service definitions.

Namespace

Drupal\service_container\ServiceContainer\ServiceProvider

Code

public function registerAnnotatedPluginTypes(&$container_definition, $parameter_definitions) {
  foreach ($parameter_definitions as $definition) {
    if (isset($definition['plugin_manager_name']) && !empty($definition['plugin_manager_name'])) {
      $plugin_manager_name = $definition['plugin_manager_name'];
    }
    else {
      $plugin_manager_name = $definition['owner'] . '.' . $definition['type'];
      $this
        ->registerAliasServices($container_definition, $definition['owner'], $definition['type']);
    }
    $container_definition['services'][$plugin_manager_name] = array();
    $container_definition['parameters']['service_container.plugin_managers']['annotated'][$plugin_manager_name] = $definition;
  }
}