diff --git a/core/core.services.yml b/core/core.services.yml index 6127c8f99bd..9f5ab7f2c5f 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1280,7 +1280,7 @@ services: class: Drupal\Core\Asset\AssetDumper library.discovery: class: Drupal\Core\Asset\LibraryDiscovery - arguments: ['@library.discovery.collector', '@cache_tags.invalidator', '@module_handler', '@theme.manager'] + arguments: ['@library.discovery.collector', '@cache_tags.invalidator'] library.discovery.collector: class: Drupal\Core\Asset\LibraryDiscoveryCollector arguments: ['@cache.discovery', '@lock', '@library.discovery.parser', '@theme.manager'] diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscovery.php b/core/lib/Drupal/Core/Asset/LibraryDiscovery.php index 71926eea14e..31b8e4d55f3 100644 --- a/core/lib/Drupal/Core/Asset/LibraryDiscovery.php +++ b/core/lib/Drupal/Core/Asset/LibraryDiscovery.php @@ -31,20 +31,6 @@ class LibraryDiscovery implements LibraryDiscoveryInterface { */ protected $cacheTagInvalidator; - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * The theme manager. - * - * @var \Drupal\Core\Theme\ThemeManagerInterface - */ - protected $themeManager; - /** * The final library definitions, statically cached. * @@ -67,11 +53,9 @@ class LibraryDiscovery implements LibraryDiscoveryInterface { * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager * The theme manager. */ - public function __construct(CacheCollectorInterface $library_discovery_collector, CacheTagsInvalidatorInterface $cache_tag_invalidator, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager) { + public function __construct(CacheCollectorInterface $library_discovery_collector, CacheTagsInvalidatorInterface $cache_tag_invalidator) { $this->collector = $library_discovery_collector; $this->cacheTagInvalidator = $cache_tag_invalidator; - $this->moduleHandler = $module_handler; - $this->themeManager = $theme_manager; } /** @@ -85,8 +69,6 @@ class LibraryDiscovery implements LibraryDiscoveryInterface { // Allow modules and themes to dynamically attach request and context // specific data for this library; e.g., localization. $library_name = "$extension/$name"; - $this->moduleHandler->alter('library', $definition, $library_name); - $this->themeManager->alter('library', $definition, $library_name); $this->libraryDefinitions[$extension][$name] = $definition; } } diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php index 3492439d198..dafbdd4eb44 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php @@ -30,20 +30,6 @@ class LibraryDiscoveryTest extends UnitTestCase { */ protected $libraryDiscoveryCollector; - /** - * The mocked module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $moduleHandler; - - /** - * The mocked theme manager. - * - * @var \Drupal\Core\Theme\ThemeManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $themeManager; - /** * The cache tags invalidator. * @@ -81,9 +67,7 @@ class LibraryDiscoveryTest extends UnitTestCase { $this->libraryDiscoveryCollector = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryCollector') ->disableOriginalConstructor() ->getMock(); - $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); - $this->themeManager = $this->getMock('Drupal\Core\Theme\ThemeManagerInterface'); - $this->libraryDiscovery = new LibraryDiscovery($this->libraryDiscoveryCollector, $this->cacheTagsInvalidator, $this->moduleHandler, $this->themeManager); + $this->libraryDiscovery = new LibraryDiscovery($this->libraryDiscoveryCollector, $this->cacheTagsInvalidator); } /** @@ -94,20 +78,6 @@ class LibraryDiscoveryTest extends UnitTestCase { ->method('get') ->with('test') ->willReturn($this->libraryData); - $this->moduleHandler->expects($this->exactly(2)) - ->method('alter') - ->with( - 'library', - $this->logicalOr($this->libraryData['test_1'], $this->libraryData['test_2']), - $this->logicalOr('test/test_1', 'test/test_2') - ); - $this->themeManager->expects($this->exactly(2)) - ->method('alter') - ->with( - 'library', - $this->logicalOr($this->libraryData['test_1'], $this->libraryData['test_2']), - $this->logicalOr('test/test_1', 'test/test_2') - ); $this->libraryDiscovery->getLibrariesbyExtension('test'); // Verify that subsequent calls don't trigger hook_library_info_alter()