Skip to content
Snippets Groups Projects
Commit 3ab61299 authored by catch's avatar catch
Browse files

Issue #3158289 by alexpott, barboza: Deprecate hook_init for theme engines

parent 66047e70
No related branches found
No related tags found
No related merge requests found
...@@ -140,11 +140,18 @@ public function loadActiveTheme(ActiveTheme $active_theme) { ...@@ -140,11 +140,18 @@ public function loadActiveTheme(ActiveTheme $active_theme) {
include_once $this->root . '/' . $active_theme->getOwner(); include_once $this->root . '/' . $active_theme->getOwner();
if (function_exists($theme_engine . '_init')) { if (function_exists($theme_engine . '_init')) {
@trigger_error('THEME_ENGINE_init() is deprecated in drupal:9.3.0 and removed in drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3246978', E_USER_DEPRECATED);
foreach ($active_theme->getBaseThemeExtensions() as $base) { foreach ($active_theme->getBaseThemeExtensions() as $base) {
call_user_func($theme_engine . '_init', $base); call_user_func($theme_engine . '_init', $base);
} }
call_user_func($theme_engine . '_init', $active_theme->getExtension()); call_user_func($theme_engine . '_init', $active_theme->getExtension());
} }
else {
foreach ($active_theme->getBaseThemeExtensions() as $base) {
$base->load();
}
$active_theme->getExtension()->load();
}
} }
else { else {
// include non-engine theme files // include non-engine theme files
......
...@@ -30,8 +30,15 @@ protected function setUp(): void { ...@@ -30,8 +30,15 @@ protected function setUp(): void {
/** /**
* Ensures a theme's template is overridable based on the 'template' filename. * Ensures a theme's template is overridable based on the 'template' filename.
*
* @group legacy
*
* @todo https://www.drupal.org/project/drupal/issues/3246981 Remove
* nyan_cat_init() and the legacy group and expected deprecation from this
* test.
*/ */
public function testTemplateOverride() { public function testTemplateOverride() {
$this->expectDeprecation('THEME_ENGINE_init() is deprecated in drupal:9.3.0 and removed in drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3246978');
$this->config('system.theme') $this->config('system.theme')
->set('default', 'test_theme_nyan_cat_engine') ->set('default', 'test_theme_nyan_cat_engine')
->save(); ->save();
......
...@@ -26,16 +26,6 @@ function twig_extension() { ...@@ -26,16 +26,6 @@ function twig_extension() {
return '.html.twig'; return '.html.twig';
} }
/**
* Includes .theme file from themes.
*
* @param \Drupal\Core\Extension\Extension $theme
* The theme extension object.
*/
function twig_init(Extension $theme) {
$theme->load();
}
/** /**
* Implements hook_render_template(). * Implements hook_render_template().
* *
......
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