Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
6122e84e
Commit
6122e84e
authored
Mar 22, 2013
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1948702
by chx: module_hook() is broken for disabled modules and included hooks.
parent
44eda14f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
4 deletions
+48
-4
core/lib/Drupal/Core/Extension/ModuleHandler.php
core/lib/Drupal/Core/Extension/ModuleHandler.php
+6
-4
core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php
...sts/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php
+42
-0
No files found.
core/lib/Drupal/Core/Extension/ModuleHandler.php
View file @
6122e84e
...
...
@@ -215,10 +215,12 @@ public function loadInclude($module, $type, $name = NULL) {
}
$name
=
$name
?:
$module
;
$file
=
DRUPAL_ROOT
.
'/'
.
dirname
(
$this
->
moduleList
[
$module
])
.
"/
$name
.
$type
"
;
if
(
is_file
(
$file
))
{
require_once
$file
;
return
$file
;
if
(
isset
(
$this
->
moduleList
[
$module
]))
{
$file
=
DRUPAL_ROOT
.
'/'
.
dirname
(
$this
->
moduleList
[
$module
])
.
"/
$name
.
$type
"
;
if
(
is_file
(
$file
))
{
require_once
$file
;
return
$file
;
}
}
return
FALSE
;
...
...
core/tests/Drupal/Tests/Core/Extension/ModuleHandlerUnitTest.php
0 → 100644
View file @
6122e84e
<?php
/**
* @file
* Contains \Drupal\Core\Extension\ModuleHanderUnitTest.
*/
namespace
Drupal\Tests\Core\Extension
;
if
(
!
defined
(
'DRUPAL_ROOT'
))
{
define
(
'DRUPAL_ROOT'
,
dirname
(
dirname
(
substr
(
__DIR__
,
0
,
-
strlen
(
__NAMESPACE__
)))));
}
use
Drupal\Core\Extension\ModuleHandler
;
use
Drupal\Tests\UnitTestCase
;
/**
* Tests the ModuleHandler class.
*
* @group System
*/
class
ModuleHandlerUnitTest
extends
UnitTestCase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'ModuleHandler functionality'
,
'description'
=>
'Tests the ModuleHandler class.'
,
'group'
=>
'System'
,
);
}
function
setUp
()
{
parent
::
setUp
();
$this
->
moduleHandler
=
new
ModuleHandler
;
}
function
testloadInclude
()
{
// Make sure that load include does not throw notices on nonexisiting
// modules.
$this
->
moduleHandler
->
loadInclude
(
'foo'
,
'inc'
);
}
}
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