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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
af9b327e
Commit
af9b327e
authored
17 years ago
by
Gábor Hojtsy
Browse files
Options
Downloads
Patches
Plain Diff
#206778
follow up by dvessel: better filtering for subtheme files
parent
b797ae5a
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/theme.inc
+19
-11
19 additions, 11 deletions
includes/theme.inc
with
19 additions
and
11 deletions
includes/theme.inc
+
19
−
11
View file @
af9b327e
...
...
@@ -754,25 +754,33 @@ function drupal_find_theme_functions($cache, $prefixes) {
function
drupal_find_theme_templates
(
$cache
,
$extension
,
$path
)
{
$templates
=
array
();
// Escape the periods in the extension.
$regex
=
str_replace
(
'.'
,
'\.'
,
$extension
)
.
'$'
;
// Collect sub-themes for the current theme. This allows base themes to have
// sub-themes in its folder hierarchy without affecting the base theme.
global
$theme
;
$sub_themes
=
array
();
// Collect paths to all sub-themes grouped by base themes. These will be
// used for filtering. This allows base themes to have sub-themes in its
// folder hierarchy without affecting the base themes template discovery.
$theme_paths
=
array
();
foreach
(
list_themes
()
as
$theme_info
)
{
if
(
!
empty
(
$theme_info
->
base_theme
)
&&
$theme_info
->
base_theme
==
$theme
)
{
$sub_themes
[]
=
dirname
(
$theme_info
->
filename
);
if
(
!
empty
(
$theme_info
->
base_theme
))
{
$theme_paths
[
$theme_info
->
base_theme
][
$theme_info
->
name
]
=
dirname
(
$theme_info
->
filename
);
}
}
foreach
(
$theme_paths
as
$basetheme
=>
$subthemes
)
{
foreach
(
$subthemes
as
$subtheme
=>
$subtheme_path
)
{
if
(
isset
(
$theme_paths
[
$subtheme
]))
{
$theme_paths
[
$basetheme
]
=
array_merge
(
$theme_paths
[
$basetheme
],
$theme_paths
[
$subtheme
]);
}
}
}
global
$theme
;
$subtheme_paths
=
isset
(
$theme_paths
[
$theme
])
?
$theme_paths
[
$theme
]
:
array
();
// Escape the periods in the extension.
$regex
=
str_replace
(
'.'
,
'\.'
,
$extension
)
.
'$'
;
// Because drupal_system_listing works the way it does, we check for real
// templates separately from checking for patterns.
$files
=
drupal_system_listing
(
$regex
,
$path
,
'name'
,
0
);
foreach
(
$files
as
$template
=>
$file
)
{
//
Catch
sub-theme
s and skip
.
if
(
strpos
(
$file
->
filename
,
str_replace
(
$sub
_
themes
,
''
,
$file
->
filename
))
!==
0
)
{
//
Ignore
sub-theme
templates for the current theme
.
if
(
strpos
(
$file
->
filename
,
str_replace
(
$subtheme
_path
s
,
''
,
$file
->
filename
))
!==
0
)
{
continue
;
}
// Chop off the remaining extensions if there are any. $template already
...
...
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