Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
drupal
Commits
3f3ebc75
Commit
3f3ebc75
authored
Apr 18, 2015
by
xjm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2472547
by lauriii, dawehner: Remove deprecated hook_library_alter()
parent
f8514fe4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
51 deletions
+3
-51
core/core.services.yml
core/core.services.yml
+1
-1
core/lib/Drupal/Core/Asset/LibraryDiscovery.php
core/lib/Drupal/Core/Asset/LibraryDiscovery.php
+1
-19
core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
+1
-31
No files found.
core/core.services.yml
View file @
3f3ebc75
...
...
@@ -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'
]
...
...
core/lib/Drupal/Core/Asset/LibraryDiscovery.php
View file @
3f3ebc75
...
...
@@ -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 @@ public function getLibrariesByExtension($extension) {
// 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
;
}
}
...
...
core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php
View file @
3f3ebc75
...
...
@@ -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 @@ protected function setUp() {
$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 @@ public function testGetLibrariesByExtension() {
->
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()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment