Token::setInfo

public Token::setInfo(array $tokens) Sets metadata describing supported tokens. Parameters array $tokens: Token metadata that has an identical structure to the return value of hook_token_info(). See also hook_token_info() File core/lib/Drupal/Core/Utility/Token.php, line 397 Class Token Drupal placeholder/token replacement system. Namespace Drupal\Core\Utility Code public function setInfo(array $tokens) { $this->tokenInfo = $tokens; }

Token::scan

public Token::scan($text) Builds a list of all token-like patterns that appear in the text. Parameters string $text: The text to be scanned for possible tokens. Return value array An associative array of discovered tokens, grouped by type. File core/lib/Drupal/Core/Utility/Token.php, line 236 Class Token Drupal placeholder/token replacement system. Namespace Drupal\Core\Utility Code public function scan($text) { // Matches tokens with the following pattern: [$type:$name] // $type

Token::resetInfo

public Token::resetInfo() Resets metadata describing supported tokens. File core/lib/Drupal/Core/Utility/Token.php, line 404 Class Token Drupal placeholder/token replacement system. Namespace Drupal\Core\Utility Code public function resetInfo() { $this->tokenInfo = NULL; $this->cacheTagsInvalidator->invalidateTags([static::TOKEN_INFO_CACHE_TAG]); }

Token::replace

public Token::replace($text, array $data = array(), array $options = array(), BubbleableMetadata $bubbleable_metadata = NULL) Replaces all tokens in a given string with appropriate values. Parameters string $text: An HTML string containing replaceable tokens. The caller is responsible for calling \Drupal\Component\Utility\Html::escape() in case the $text was plain text. array $data: (optional) An array of keyed objects. For simple replacement scenarios 'node', 'user', and others are common key

Token::getInfo

public Token::getInfo() Returns the element properties for this element. Return value array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format. Overrides Hidden::getInfo File core/lib/Drupal/Core/Render/Element/Token.php, line 22 Class Token Stores token data in a hidden form field. Namespace Drupal\Core\Render\Element Code public function getInfo() {

Token::getInfo

public Token::getInfo() Returns metadata describing supported tokens. The metadata array contains token type, name, and description data as well as an optional pointer indicating that the token chains to another set of tokens. Return value array An associative array of token information, grouped by token type. The array structure is identical to that of hook_token_info(). See also hook_token_info() File core/lib/Drupal/Core/Utility/Token.php, line 369 Class Token Drupal placeholder/token

Token::generate

public Token::generate($type, array $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) Generates replacement values for a list of tokens. Parameters string $type: The type of token being replaced. 'node', 'user', and 'date' are common. array $tokens: An array of tokens to be replaced, keyed by the literal text of the token as it appeared in the source text. array $data: An array of keyed objects. For simple replacement scenarios: 'node', 'user', and others are commo

Token::findWithPrefix

public Token::findWithPrefix(array $tokens, $prefix, $delimiter = ':') Returns a list of tokens that begin with a specific prefix. Used to extract a group of 'chained' tokens (such as [node:author:name]) from the full list of tokens found in text. For example: $data = array( 'author:name' => '[node:author:name]', 'title' => '[node:title]', 'created' => '[node:created]', ); $results = Token::findWithPrefix($data, 'author'); $results == array('name' => '[

Token::$tokenInfo

Token definitions. An array of token definitions, or NULL when the definitions are not set. Type: array[]|null See also self::setInfo() self::getInfo() self::resetInfo() File core/lib/Drupal/Core/Utility/Token.php, line 91 Class Token Drupal placeholder/token replacement system. Namespace Drupal\Core\Utility Code protected $tokenInfo;

Token::$renderer

The renderer. Type: \Drupal\Core\Render\RendererInterface File core/lib/Drupal/Core/Utility/Token.php, line 112 Class Token Drupal placeholder/token replacement system. Namespace Drupal\Core\Utility Code protected $renderer;