function Token::replacePlain

Same name in other branches
  1. 10 core/lib/Drupal/Core/Utility/Token.php \Drupal\Core\Utility\Token::replacePlain()
  2. 11.x core/lib/Drupal/Core/Utility/Token.php \Drupal\Core\Utility\Token::replacePlain()

Replaces all tokens in a given plain text string with appropriate values.

Parameters

string $plain: Plain text string.

array $data: (optional) An array of keyed objects. See replace().

array $options: (optional) A keyed array of options. See replace().

\Drupal\Core\Render\BubbleableMetadata|null $bubbleable_metadata: (optional) Target for adding metadata. See replace().

Return value

string The entered plain text with tokens replaced.

File

core/lib/Drupal/Core/Utility/Token.php, line 209

Class

Token
Drupal placeholder/token replacement system.

Namespace

Drupal\Core\Utility

Code

public function replacePlain(string $plain, array $data = [], array $options = [], BubbleableMetadata $bubbleable_metadata = NULL) : string {
    return $this->doReplace(FALSE, $plain, $data, $options, $bubbleable_metadata);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.