Skip to content

Commit

Permalink
Issue #3120954 by tim.plunkett, czigor: Add function name to the depr…
Browse files Browse the repository at this point in the history
…ecation message about theme functions

(cherry picked from commit 6cd25dfddba8f57b807cf73535e205e6588b8543)
  • Loading branch information
xjm committed Mar 19, 2020
1 parent 0a14208 commit 3546825
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Drupal/Core/Theme/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ protected function processExtension(array &$cache, $name, $type, $theme, $path)
// if the theme hook specifies a function callback instead, check to
// ensure the function actually exists.
if (isset($info['function'])) {
@trigger_error('Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead. See https://www.drupal.org/node/1831138', E_USER_DEPRECATED);
@trigger_error(sprintf('Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of %s(). See https://www.drupal.org/node/1831138', $info['function']), E_USER_DEPRECATED);
if (!function_exists($info['function'])) {
throw new \BadFunctionCallException(sprintf(
'Theme hook "%s" refers to a theme function callback that does not exist: "%s"',
Expand Down
4 changes: 2 additions & 2 deletions tests/Drupal/KernelTests/Core/Theme/RegistryLegacyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RegistryLegacyTest extends KernelTestBase {
/**
* Tests the theme registry with theme functions and multiple subthemes.
*
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead. See https://www.drupal.org/node/1831138
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_theme_test(). See https://www.drupal.org/node/1831138
*/
public function testMultipleSubThemes() {
$theme_handler = \Drupal::service('theme_handler');
Expand All @@ -47,7 +47,7 @@ public function testMultipleSubThemes() {
/**
* Tests the theme registry with theme functions with suggestions.
*
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead. See https://www.drupal.org/node/1831138
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of test_legacy_theme_theme_test_preprocess_suggestions__kitten__meerkat(). See https://www.drupal.org/node/1831138
*/
public function testSuggestionPreprocessFunctions() {
$theme_handler = \Drupal::service('theme_handler');
Expand Down
2 changes: 1 addition & 1 deletion tests/Drupal/Tests/Core/Theme/RegistryLegacyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function setUp() {
/**
* Tests getting legacy theme function registry data defined by a module.
*
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead. See https://www.drupal.org/node/1831138
* @expectedDeprecation Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_theme_test(). See https://www.drupal.org/node/1831138
*/
public function testGetLegacyThemeFunctionRegistryForModule() {
$test_theme = new ActiveTheme([
Expand Down

0 comments on commit 3546825

Please sign in to comment.