Issue #3348848 by andypost, Purencool, daffie: Deprecate theme_get_registry()
parent
8a924f778d
commit
0e8a558b4f
|
@ -87,13 +87,20 @@ const RESPONSIVE_PRIORITY_LOW = 'priority-low';
|
|||
* @return array|\Drupal\Core\Utility\ThemeRegistry
|
||||
* The complete theme registry array, or an instance of the
|
||||
* Drupal\Core\Utility\ThemeRegistry class.
|
||||
*
|
||||
* @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use
|
||||
* theme.registry service methods get() or getRuntime() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/3348850
|
||||
*/
|
||||
function theme_get_registry($complete = TRUE) {
|
||||
$theme_registry = \Drupal::service('theme.registry');
|
||||
if ($complete) {
|
||||
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method get() instead. See https://www.drupal.org/node/3348850', E_USER_DEPRECATED);
|
||||
return $theme_registry->get();
|
||||
}
|
||||
else {
|
||||
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method getRuntime() instead. See https://www.drupal.org/node/3348850', E_USER_DEPRECATED);
|
||||
return $theme_registry->getRuntime();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -547,7 +547,7 @@ function hook_preprocess(&$variables, $hook) {
|
|||
}
|
||||
|
||||
if (!isset($hooks)) {
|
||||
$hooks = theme_get_registry();
|
||||
$hooks = \Drupal::service('theme.registry')->get();
|
||||
}
|
||||
|
||||
// Determine the primary theme function argument.
|
||||
|
|
|
@ -272,4 +272,18 @@ class RegistryTest extends KernelTestBase {
|
|||
$this->assertSame($hooks, $registry->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests deprecated theme_get_registry function.
|
||||
*
|
||||
* @see theme_get_registry()
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyThemeGetRegistry() {
|
||||
$registry = \Drupal::service('theme.registry');
|
||||
$this->expectDeprecation('theme_get_registry() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method get() instead. See https://www.drupal.org/node/3348850');
|
||||
$this->assertEquals($registry->get(), theme_get_registry());
|
||||
$this->expectDeprecation('theme_get_registry() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use theme.registry service method getRuntime() instead. See https://www.drupal.org/node/3348850');
|
||||
$this->assertEquals($registry->getRuntime(), theme_get_registry(FALSE));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue