function RegisterStreamWrappersPass::process

Same name in other branches
  1. 9 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass::process()
  2. 10 core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass::process()
  3. 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php \Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass::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', [
            $id,
            $class,
            $scheme,
        ]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.