Issue #1377740: revert unintentional theme.inc changes.

8.2.x
Nathaniel Catchpole 2016-06-23 10:50:41 +01:00
parent 1da4d15cd8
commit 032d127b69
1 changed files with 5 additions and 4 deletions

View File

@ -134,8 +134,7 @@ function drupal_theme_rebuild() {
*/
function drupal_find_theme_functions($cache, $prefixes) {
$implementations = [];
$functions = get_defined_functions();
$theme_functions = preg_grep('/^(' . implode(')|(', $prefixes) . ')_/', $functions['user']);
$grouped_functions = \Drupal::service('theme.registry')->getPrefixGroupedUserFunctions();
foreach ($cache as $hook => $info) {
foreach ($prefixes as $prefix) {
@ -151,8 +150,10 @@ function drupal_find_theme_functions($cache, $prefixes) {
// are found using the base hook's pattern, not a pattern from an
// intermediary suggestion.
$pattern = isset($info['pattern']) ? $info['pattern'] : ($hook . '__');
if (!isset($info['base hook']) && !empty($pattern)) {
$matches = preg_grep('/^' . $prefix . '_' . $pattern . '/', $theme_functions);
// Grep only the functions which are within the prefix group.
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) {
foreach ($matches as $match) {
$new_hook = substr($match, strlen($prefix) + 1);