You are here

public static function Drupal::token in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::token()
  2. 9 core/lib/Drupal.php \Drupal::token()

Returns the token service.

Return value

\Drupal\Core\Utility\Token The token service.

36 calls to Drupal::token()
AreaTest::testRenderAreaToken in core/modules/views/tests/src/Functional/Handler/AreaTest.php
Tests global tokens.
CommentTokenReplaceTest::testCommentTokenReplacement in core/modules/comment/tests/src/Functional/CommentTokenReplaceTest.php
Creates a comment, then tests the tokens generated from it.
comment_tokens in core/modules/comment/comment.tokens.inc
Implements hook_tokens().
DrupalTest::testToken in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the token() method.
FileFieldPathTest::testUploadPath in core/modules/file/tests/src/Functional/FileFieldPathTest.php
Tests the normal formatter display on node display.

... See full list

File

core/lib/Drupal.php, line 553

Class

Drupal
Static Service Container wrapper.

Code

public static function token() {
  return static::getContainer()
    ->get('token');
}