Issue #2472547 by lauriii, dawehner: Remove deprecated hook_library_alter()
parent
f8514fe434
commit
3f3ebc7553
|
@ -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']
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue