You are here

public function TwigExtension::tokenReplaceFilter in Twig Tweak 8

Same name and namespace in other branches
  1. 8.2 src/TwigExtension.php \Drupal\twig_tweak\TwigExtension::tokenReplaceFilter()

Replaces all tokens in a given string with appropriate values.

Parameters

string $text: An HTML string containing replaceable tokens.

Return value

string The entered HTML text with tokens replaced.

File

src/TwigExtension.php, line 402

Class

TwigExtension
Twig extension with some useful functions and filters.

Namespace

Drupal\twig_tweak

Code

public function tokenReplaceFilter($text) {
  return \Drupal::token()
    ->replace($text);
}