Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
80554ebf
Commit
80554ebf
authored
Sep 1, 2016
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2720849
by joseph.olstad, quicksketch: D8 improve theme registry build performance
parent
b9aa30a0
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/includes/theme.inc
+1
-1
1 addition, 1 deletion
core/includes/theme.inc
core/lib/Drupal/Core/Theme/Registry.php
+15
-4
15 additions, 4 deletions
core/lib/Drupal/Core/Theme/Registry.php
with
16 additions
and
5 deletions
core/includes/theme.inc
+
1
−
1
View file @
80554ebf
...
...
@@ -134,7 +134,7 @@ function drupal_theme_rebuild() {
*/
function
drupal_find_theme_functions
(
$cache
,
$prefixes
)
{
$implementations
=
[];
$grouped_functions
=
\Drupal
::
service
(
'theme.registry'
)
->
getPrefixGroupedUserFunctions
();
$grouped_functions
=
\Drupal
::
service
(
'theme.registry'
)
->
getPrefixGroupedUserFunctions
(
$prefixes
);
foreach
(
$cache
as
$hook
=>
$info
)
{
foreach
(
$prefixes
as
$prefix
)
{
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/Theme/Registry.php
+
15
−
4
View file @
80554ebf
...
...
@@ -633,8 +633,6 @@ protected function completeSuggestion($hook, array &$cache) {
* @see ::processExtension()
*/
protected
function
postProcessExtension
(
array
&
$cache
,
ActiveTheme
$theme
)
{
$grouped_functions
=
$this
->
getPrefixGroupedUserFunctions
();
// Gather prefixes. This will be used to limit the found functions to the
// expected naming conventions.
$prefixes
=
array_keys
((
array
)
$this
->
moduleHandler
->
getModuleList
());
...
...
@@ -646,6 +644,8 @@ protected function postProcessExtension(array &$cache, ActiveTheme $theme) {
}
$prefixes
[]
=
$theme
->
getName
();
$grouped_functions
=
$this
->
getPrefixGroupedUserFunctions
(
$prefixes
);
// Collect all variable preprocess functions in the correct order.
$suggestion_level
=
[];
$matches
=
[];
...
...
@@ -744,15 +744,26 @@ public function destruct() {
/**
* Gets all user functions grouped by the word before the first underscore.
*
* @param $prefixes
* An array of function prefixes by which the list can be limited.
* @return array
* Functions grouped by the first prefix.
*/
public
function
getPrefixGroupedUserFunctions
()
{
public
function
getPrefixGroupedUserFunctions
(
$prefixes
=
array
()
)
{
$functions
=
get_defined_functions
();
// If a list of prefixes is supplied, trim down the list to those items
// only as efficiently as possible.
if
(
$prefixes
)
{
$theme_functions
=
preg_grep
(
'/^('
.
implode
(
')|('
,
$prefixes
)
.
')_/'
,
$functions
[
'user'
]);
}
else
{
$theme_functions
=
$functions
[
'user'
];
}
$grouped_functions
=
[];
// Splitting user defined functions into groups by the first prefix.
foreach
(
$functions
[
'user'
]
as
$function
)
{
foreach
(
$
theme_
functions
as
$function
)
{
list
(
$first_prefix
,)
=
explode
(
'_'
,
$function
,
2
);
$grouped_functions
[
$first_prefix
][]
=
$function
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment