Loading core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php +11 −4 Original line number Diff line number Diff line Loading @@ -20,11 +20,18 @@ public function process(ContainerBuilder $container) { $stream_wrapper_manager = $container->getDefinition('stream_wrapper_manager'); foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $attributes) { foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $tags) { $class = $container->getDefinition($id)->getClass(); $scheme = $attributes[0]['scheme']; $stream_wrapper_manager->addMethodCall('addStreamWrapper', [$id, $class, $scheme]); // Loop through all the tags for this stream wrapper as we may have // multiple schemes. foreach ($tags as $attributes) { $scheme = $attributes['scheme']; $stream_wrapper_manager->addMethodCall('addStreamWrapper', [ $id, $class, $scheme, ]); } } } Loading core/modules/file/tests/file_test/file_test.services.yml +5 −0 Original line number Diff line number Diff line Loading @@ -15,3 +15,8 @@ services: class: Drupal\file_test\StreamWrapper\DummyExternalReadOnlyWrapper tags: - { name: stream_wrapper, scheme: dummy-external-readonly } stream_wrapper.dummy_multiple: class: Drupal\file_test\StreamWrapper\DummyMultipleStreamWrapper tags: - { name: stream_wrapper, scheme: dummy1 } - { name: stream_wrapper, scheme: dummy2 } core/modules/file/tests/file_test/src/StreamWrapper/DummyMultipleStreamWrapper.php 0 → 100644 +10 −0 Original line number Diff line number Diff line <?php namespace Drupal\file_test\StreamWrapper; /** * Helper class for testing the stream wrapper registry. * * Dummy stream wrapper implementation (dummy1://, dummy2://). */ class DummyMultipleStreamWrapper extends DummyStreamWrapper {} core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +2 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,8 @@ public function testModuleStreamWrappers() { file_exists('dummy://'); $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(); $this->assertTrue(isset($stream_wrappers['dummy'])); $this->assertTrue(isset($stream_wrappers['dummy1'])); $this->assertTrue(isset($stream_wrappers['dummy2'])); } /** Loading Loading
core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterStreamWrappersPass.php +11 −4 Original line number Diff line number Diff line Loading @@ -20,11 +20,18 @@ public function process(ContainerBuilder $container) { $stream_wrapper_manager = $container->getDefinition('stream_wrapper_manager'); foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $attributes) { foreach ($container->findTaggedServiceIds('stream_wrapper') as $id => $tags) { $class = $container->getDefinition($id)->getClass(); $scheme = $attributes[0]['scheme']; $stream_wrapper_manager->addMethodCall('addStreamWrapper', [$id, $class, $scheme]); // Loop through all the tags for this stream wrapper as we may have // multiple schemes. foreach ($tags as $attributes) { $scheme = $attributes['scheme']; $stream_wrapper_manager->addMethodCall('addStreamWrapper', [ $id, $class, $scheme, ]); } } } Loading
core/modules/file/tests/file_test/file_test.services.yml +5 −0 Original line number Diff line number Diff line Loading @@ -15,3 +15,8 @@ services: class: Drupal\file_test\StreamWrapper\DummyExternalReadOnlyWrapper tags: - { name: stream_wrapper, scheme: dummy-external-readonly } stream_wrapper.dummy_multiple: class: Drupal\file_test\StreamWrapper\DummyMultipleStreamWrapper tags: - { name: stream_wrapper, scheme: dummy1 } - { name: stream_wrapper, scheme: dummy2 }
core/modules/file/tests/file_test/src/StreamWrapper/DummyMultipleStreamWrapper.php 0 → 100644 +10 −0 Original line number Diff line number Diff line <?php namespace Drupal\file_test\StreamWrapper; /** * Helper class for testing the stream wrapper registry. * * Dummy stream wrapper implementation (dummy1://, dummy2://). */ class DummyMultipleStreamWrapper extends DummyStreamWrapper {}
core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +2 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,8 @@ public function testModuleStreamWrappers() { file_exists('dummy://'); $stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(); $this->assertTrue(isset($stream_wrappers['dummy'])); $this->assertTrue(isset($stream_wrappers['dummy1'])); $this->assertTrue(isset($stream_wrappers['dummy2'])); } /** Loading