Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3174996
Commits
189132a2
Commit
189132a2
authored
12 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1875592
by dawehner: Remove _views_find_module_templates().
parent
99fa84cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/views/views.module
+0
-78
0 additions, 78 deletions
core/modules/views/views.module
with
0 additions
and
78 deletions
core/modules/views/views.module
+
0
−
78
View file @
189132a2
...
...
@@ -192,84 +192,6 @@ function views_theme($existing, $type, $theme, $path) {
return
$hooks
;
}
/**
* Scans a directory of a module for template files.
*
* @param $cache
* The existing cache of theme hooks to test against.
* @param $path
* The path to search.
*
* @see drupal_find_theme_templates()
*/
function
_views_find_module_templates
(
$cache
,
$path
)
{
$templates
=
array
();
$regex
=
'/'
.
'\.tpl\.php'
.
'$'
.
'/'
;
// @todo Remove this once #1626580 is committed. For now, We need to remove
// the sites/* part of the path because drupal_system_listing() is already
// adding that.
$path
=
preg_replace
(
'/^sites\/all\//'
,
''
,
$path
);
$config
=
str_replace
(
'/'
,
'\/'
,
conf_path
());
$path
=
preg_replace
(
'/^'
.
$config
.
'\//'
,
''
,
$path
);
// 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
)
{
// Chop off the remaining extensions if there are any. $template already
// has the rightmost extension removed, but there might still be more,
// such as with .tpl.php, which still has .tpl in $template at this point.
if
((
$pos
=
strpos
(
$template
,
'.'
))
!==
FALSE
)
{
$template
=
substr
(
$template
,
0
,
$pos
);
}
// Transform - in filenames to _ to match function naming scheme
// for the purposes of searching.
$hook
=
strtr
(
$template
,
'-'
,
'_'
);
if
(
isset
(
$cache
[
$hook
]))
{
$templates
[
$hook
]
=
array
(
'template'
=>
$template
,
'path'
=>
dirname
(
$file
->
filename
),
'includes'
=>
isset
(
$cache
[
$hook
][
'includes'
])
?
$cache
[
$hook
][
'includes'
]
:
NULL
,
);
}
// Ensure that the pattern is maintained from base themes to its sub-themes.
// Each sub-theme will have their templates scanned so the pattern must be
// held for subsequent runs.
if
(
isset
(
$cache
[
$hook
][
'pattern'
]))
{
$templates
[
$hook
][
'pattern'
]
=
$cache
[
$hook
][
'pattern'
];
}
}
$patterns
=
array_keys
(
$files
);
foreach
(
$cache
as
$hook
=>
$info
)
{
if
(
!
empty
(
$info
[
'pattern'
]))
{
// Transform _ in pattern to - to match file naming scheme
// for the purposes of searching.
$pattern
=
strtr
(
$info
[
'pattern'
],
'_'
,
'-'
);
$matches
=
preg_grep
(
'/^'
.
$pattern
.
'/'
,
$patterns
);
if
(
$matches
)
{
foreach
(
$matches
as
$match
)
{
$file
=
substr
(
$match
,
0
,
strpos
(
$match
,
'.'
));
// Put the underscores back in for the hook name and register this pattern.
$templates
[
strtr
(
$file
,
'-'
,
'_'
)]
=
array
(
'template'
=>
$file
,
'path'
=>
dirname
(
$files
[
$match
]
->
uri
),
'variables'
=>
isset
(
$info
[
'variables'
])
?
$info
[
'variables'
]
:
NULL
,
'render element'
=>
isset
(
$info
[
'render element'
])
?
$info
[
'render element'
]
:
NULL
,
'base hook'
=>
$hook
,
'includes'
=>
isset
(
$info
[
'includes'
])
?
$info
[
'includes'
]
:
NULL
,
);
}
}
}
}
return
$templates
;
}
/**
* Returns a list of plugins and metadata about them.
*
...
...
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