diff --git a/src/Tests/TokenUnitTest.php b/src/Tests/TokenUnitTest.php index 30e766d..7f165a2 100644 --- a/src/Tests/TokenUnitTest.php +++ b/src/Tests/TokenUnitTest.php @@ -30,12 +30,11 @@ class TokenUnitTest extends TokenKernelTestBase { */ public function setUp() { parent::setUp(); - $this->tokenService = \Drupal::token(); } /** - * Test token_get_invalid_tokens() and token_get_invalid_tokens_by_context(). + * Test invalid tokens. */ public function testGetInvalidTokens() { $tests = array(); diff --git a/token.pages.inc b/token.pages.inc index 2a1facc..971c1a8 100644 --- a/token.pages.inc +++ b/token.pages.inc @@ -86,14 +86,16 @@ function theme_tree_table($variables) { * @ingroup themeable */ function theme_token_tree($variables) { + /** @var \Drupal\token\Token $token_service */ + $token_service = \Drupal::token(); $token_types = $variables['token_types']; - $info = token_get_info(); + $info = $token_service->getInfo(); if ($token_types == 'all') { $token_types = array_keys($info['types']); } elseif ($variables['global_types']) { - $token_types = array_merge($token_types, token_get_global_token_types()); + $token_types = array_merge($token_types, $token_service->getGlobalTokenTypes()); } $element = array( diff --git a/token.tokens.inc b/token.tokens.inc index bf29c31..d803a2d 100644 --- a/token.tokens.inc +++ b/token.tokens.inc @@ -933,7 +933,7 @@ function token_tokens($type, array $tokens, array $data = array(), array $option // present in $data, then throw an error. if (!empty($GLOBALS['drupal_test_info']['test_run_id'])) { // Only check when tests are running. - $type_info = token_get_info($type); + $type_info = \Drupal::token()->getTypeInfo($type); if (!empty($type_info['needs-data']) && !isset($data[$type_info['needs-data']])) { trigger_error(t('Attempting to perform token replacement for token type %type without required data', array('%type' => $type)), E_USER_WARNING); }