You are here

public function ServiceContainerServiceProvider::registerAliasServices in Service Container 7

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

Register aliases for the service.

Parameters

array $container_definition: The container definition to process.

string $owner: The owner, here, the name of the module

string $plugin_type: The type of plugin

2 calls to ServiceContainerServiceProvider::registerAliasServices()
ServiceContainerServiceProvider::registerAnnotatedPluginTypes in src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php
Automatically register all annotated Plugins.
ServiceContainerServiceProvider::registerCToolsPluginTypes in src/ServiceContainer/ServiceProvider/ServiceContainerServiceProvider.php
Automatically register all ctools plugins of the given types.

File

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

Class

ServiceContainerServiceProvider
Provides render cache service definitions.

Namespace

Drupal\service_container\ServiceContainer\ServiceProvider

Code

public function registerAliasServices(&$container_definition, $owner, $plugin_type) {

  // Register service with original string.
  $name = $owner . '.' . $plugin_type;
  $container_definition['services'][$name] = array();

  // Check candidates for needed aliases.
  $candidates = array();
  $candidates[$owner . '.' . Container::underscore($plugin_type)] = TRUE;
  $candidates[$name] = FALSE;
  foreach ($candidates as $candidate => $value) {
    if ($value) {
      $container_definition['aliases'][$candidate] = $name;
    }
  }
}