Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Theme/Registry.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
| author | Chris Cannam |
|---|---|
| date | Mon, 23 Apr 2018 09:46:53 +0100 |
| parents | 4c8ae668cc8c |
| children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
| 13:5fb285c0d0e3 | 14:1fec387a4317 |
|---|---|
| 1 <?php | 1 <?php |
| 2 | 2 |
| 3 namespace Drupal\Core\Theme; | 3 namespace Drupal\Core\Theme; |
| 4 | 4 |
| 5 use Drupal\Component\Utility\NestedArray; | |
| 5 use Drupal\Core\Cache\Cache; | 6 use Drupal\Core\Cache\Cache; |
| 6 use Drupal\Core\Cache\CacheBackendInterface; | 7 use Drupal\Core\Cache\CacheBackendInterface; |
| 7 use Drupal\Core\DestructableInterface; | 8 use Drupal\Core\DestructableInterface; |
| 8 use Drupal\Core\Extension\ModuleHandlerInterface; | 9 use Drupal\Core\Extension\ModuleHandlerInterface; |
| 9 use Drupal\Core\Extension\ThemeHandlerInterface; | 10 use Drupal\Core\Extension\ThemeHandlerInterface; |
| 563 } | 564 } |
| 564 elseif (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions'])) { | 565 elseif (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions'])) { |
| 565 $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); | 566 $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); |
| 566 } | 567 } |
| 567 $result[$hook]['preprocess functions'] = $info['preprocess functions']; | 568 $result[$hook]['preprocess functions'] = $info['preprocess functions']; |
| 569 | |
| 570 // If a theme implementation definition provides both 'template' and | |
| 571 // 'function', the 'function' will be used. In this case, if the new | |
| 572 // result provides a 'template' value, any existing 'function' value | |
| 573 // must be removed for the override to be called. | |
| 574 if (isset($result[$hook]['template'])) { | |
| 575 unset($cache[$hook]['function']); | |
| 576 } | |
| 568 } | 577 } |
| 569 | 578 |
| 570 // Merge the newly created theme hooks into the existing cache. | 579 // Merge the newly created theme hooks into the existing cache. |
| 571 $cache = $result + $cache; | 580 $cache = NestedArray::mergeDeep($cache, $result); |
| 572 } | 581 } |
| 573 | 582 |
| 574 // Let themes have variable preprocessors even if they didn't register a | 583 // Let themes have variable preprocessors even if they didn't register a |
| 575 // template. | 584 // template. |
| 576 if ($type == 'theme' || $type == 'base_theme') { | 585 if ($type == 'theme' || $type == 'base_theme') { |
