Issue #3269154 by longwave: Remove BC layers from the theme system

merge-requests/3031/head
Alex Pott 2022-04-25 17:12:59 +01:00
parent f88b4a9a8a
commit 3fc595ad16
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
6 changed files with 6 additions and 69 deletions

View File

@ -108,7 +108,7 @@ class HtmlRenderer implements MainContentRendererInterface {
* @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager
* The theme manager.
*/
public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ModuleHandlerInterface $module_handler, RendererInterface $renderer, RenderCacheInterface $render_cache, array $renderer_config, ThemeManagerInterface $theme_manager = NULL) {
public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ModuleHandlerInterface $module_handler, RendererInterface $renderer, RenderCacheInterface $render_cache, array $renderer_config, ThemeManagerInterface $theme_manager) {
$this->titleResolver = $title_resolver;
$this->displayVariantManager = $display_variant_manager;
$this->eventDispatcher = $event_dispatcher;
@ -116,10 +116,6 @@ class HtmlRenderer implements MainContentRendererInterface {
$this->renderer = $renderer;
$this->renderCache = $render_cache;
$this->rendererConfig = $renderer_config;
if ($theme_manager === NULL) {
@trigger_error('Calling ' . __METHOD__ . ' without the $theme_manager argument is deprecated in drupal:9.1.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3159762', E_USER_DEPRECATED);
$theme_manager = \Drupal::service('theme.manager');
}
$this->themeManager = $theme_manager;
}

View File

@ -812,22 +812,4 @@ class Registry implements DestructableInterface {
return $grouped_functions;
}
/**
* Wraps drupal_get_path().
*
* @param string $module
* The name of the item for which the path is requested.
*
* @return string
*
* @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
* \Drupal\Core\Extension\ExtensionList::getPath() instead.
*
* @see https://www.drupal.org/node/2940438
*/
protected function getPath($module) {
@trigger_error(__METHOD__ . ' is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionList::getPath() instead. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
return $this->moduleList->getPath($module);
}
}

View File

@ -138,20 +138,10 @@ class ThemeInitialization implements ThemeInitializationInterface {
if ($theme_engine = $active_theme->getEngine()) {
// Include the engine.
include_once $this->root . '/' . $active_theme->getOwner();
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) {
call_user_func($theme_engine . '_init', $base);
}
call_user_func($theme_engine . '_init', $active_theme->getExtension());
}
else {
foreach ($active_theme->getBaseThemeExtensions() as $base) {
$base->load();
}
$active_theme->getExtension()->load();
foreach ($active_theme->getBaseThemeExtensions() as $base) {
$base->load();
}
$active_theme->getExtension()->load();
}
else {
// include non-engine theme files

View File

@ -30,15 +30,8 @@ class EngineNyanCatTest extends BrowserTestBase {
/**
* 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() {
$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')
->set('default', 'test_theme_nyan_cat_engine')
->save();

View File

@ -7,16 +7,6 @@
use Drupal\Core\Extension\Extension;
/**
* Includes .theme file from themes.
*
* @param \Drupal\Core\Extension\Extension $theme
* The theme extension object.
*/
function nyan_cat_init(Extension $theme) {
$theme->load();
}
/**
* Implements hook_theme().
*/

View File

@ -89,7 +89,8 @@ class RegistryTest extends UnitTestCase {
$this->themeInitialization = $this->createMock('Drupal\Core\Theme\ThemeInitializationInterface');
$this->themeManager = $this->createMock('Drupal\Core\Theme\ThemeManagerInterface');
$this->moduleList = $this->createMock(ModuleExtensionList::class);
$this->setupTheme();
$this->registry = new Registry($this->root, $this->cache, $this->lock, $this->moduleHandler, $this->themeHandler, $this->themeInitialization, NULL, NULL, $this->moduleList);
$this->registry->setThemeManager($this->themeManager);
}
/**
@ -484,21 +485,6 @@ class RegistryTest extends UnitTestCase {
return $data;
}
protected function setupTheme() {
$this->registry = $this->getMockBuilder(Registry::class)
->onlyMethods(['getPath'])
->setConstructorArgs([$this->root, $this->cache, $this->lock, $this->moduleHandler, $this->themeHandler, $this->themeInitialization, NULL, NULL, $this->moduleList])
->getMock();
$this->registry->expects($this->any())
->method('getPath')
->willReturnCallback(function ($module) {
if ($module == 'theme_test') {
return 'core/modules/system/tests/modules/theme_test';
}
});
$this->registry->setThemeManager($this->themeManager);
}
}
namespace Drupal\Core\Theme;