Skip to content
Snippets Groups Projects
Commit 032d127b authored by catch's avatar catch
Browse files

Issue #1377740: revert unintentional theme.inc changes.

parent 1da4d15c
No related branches found
No related tags found
No related merge requests found
...@@ -134,8 +134,7 @@ function drupal_theme_rebuild() { ...@@ -134,8 +134,7 @@ function drupal_theme_rebuild() {
*/ */
function drupal_find_theme_functions($cache, $prefixes) { function drupal_find_theme_functions($cache, $prefixes) {
$implementations = []; $implementations = [];
$functions = get_defined_functions(); $grouped_functions = \Drupal::service('theme.registry')->getPrefixGroupedUserFunctions();
$theme_functions = preg_grep('/^(' . implode(')|(', $prefixes) . ')_/', $functions['user']);
foreach ($cache as $hook => $info) { foreach ($cache as $hook => $info) {
foreach ($prefixes as $prefix) { foreach ($prefixes as $prefix) {
...@@ -151,8 +150,10 @@ function drupal_find_theme_functions($cache, $prefixes) { ...@@ -151,8 +150,10 @@ function drupal_find_theme_functions($cache, $prefixes) {
// are found using the base hook's pattern, not a pattern from an // are found using the base hook's pattern, not a pattern from an
// intermediary suggestion. // intermediary suggestion.
$pattern = isset($info['pattern']) ? $info['pattern'] : ($hook . '__'); $pattern = isset($info['pattern']) ? $info['pattern'] : ($hook . '__');
if (!isset($info['base hook']) && !empty($pattern)) { // Grep only the functions which are within the prefix group.
$matches = preg_grep('/^' . $prefix . '_' . $pattern . '/', $theme_functions); list($first_prefix,) = explode('_', $prefix, 2);
if (!isset($info['base hook']) && !empty($pattern) && isset($grouped_functions[$first_prefix])) {
$matches = preg_grep('/^' . $prefix . '_' . $pattern . '/', $grouped_functions[$first_prefix]);
if ($matches) { if ($matches) {
foreach ($matches as $match) { foreach ($matches as $match) {
$new_hook = substr($match, strlen($prefix) + 1); $new_hook = substr($match, strlen($prefix) + 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment