Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
3a27db99
Commit
3a27db99
authored
Apr 03, 2014
by
Angie Byron
Browse files
Issue
#2232649
by msonnabaum: _theme micro-optimization.
parent
6edcdee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/includes/theme.inc
View file @
3a27db99
...
...
@@ -390,10 +390,13 @@ function list_themes($refresh = FALSE) {
*/
function
_theme
(
$hook
,
$variables
=
array
())
{
static
$default_attributes
;
$module_handler
=
\
Drupal
::
moduleHandler
();
// If called before all modules are loaded, we do not necessarily have a full
// theme registry to work with, and therefore cannot process the theme
// request properly. See also \Drupal\Core\Theme\Registry::get().
if
(
!
\
Drupal
::
module
H
andler
()
->
isLoaded
()
&&
!
defined
(
'MAINTENANCE_MODE'
))
{
if
(
!
$
module
_h
andler
->
isLoaded
()
&&
!
defined
(
'MAINTENANCE_MODE'
))
{
throw
new
Exception
(
t
(
'_theme() may not be called until all modules are loaded.'
));
}
...
...
@@ -488,7 +491,7 @@ function _theme($hook, $variables = array()) {
}
// Invoke hook_theme_suggestions_HOOK().
$suggestions
=
Drupal
::
module
H
andler
()
->
invokeAll
(
'theme_suggestions_'
.
$base_theme_hook
,
array
(
$variables
));
$suggestions
=
$
module
_h
andler
->
invokeAll
(
'theme_suggestions_'
.
$base_theme_hook
,
array
(
$variables
));
// If _theme() was invoked with a direct theme suggestion like
// '#theme' => 'node__article', add it to the suggestions array before
// invoking suggestion alter hooks.
...
...
@@ -502,7 +505,7 @@ function _theme($hook, $variables = array()) {
'theme_suggestions'
,
'theme_suggestions_'
.
$base_theme_hook
,
);
\
Drupal
::
module
H
andler
()
->
alter
(
$hooks
,
$suggestions
,
$variables
,
$base_theme_hook
);
$
module
_h
andler
->
alter
(
$hooks
,
$suggestions
,
$variables
,
$base_theme_hook
);
// Check if each suggestion exists in the theme registry, and if so,
// use it instead of the hook that _theme() was called with. For example, a
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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