public function RegisterStreamWrappersPass::process

public RegisterStreamWrappersPass::process(ContainerBuilder $container)

You can modify the container here before it is dumped to PHP code.

Parameters

ContainerBuilder $container:

Overrides CompilerPassInterface::process

File

core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php, line 16

Class

RegisterStreamWrappersPass
Adds services tagged 'stream_wrapper' to the stream_wrapper_manager service.

Namespace

Drupal\Core\DependencyInjection\Compiler

Code

public function process(ContainerBuilder $container) {
  if (!$container->hasDefinition('stream_wrapper_manager')) {
    return;
  }

  $stream_wrapper_manager = $container->getDefinition('stream_wrapper_manager');

  foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $attributes) {
    $class = $container->getDefinition($id)->getClass();
    $scheme = $attributes[0]['scheme'];

    $stream_wrapper_manager->addMethodCall('addStreamWrapper', array($id, $class, $scheme));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DependencyInjection!Compiler!RegisterStreamWrappersPass.php/function/RegisterStreamWrappersPass::process/8.1.x