public function Token::substituteToken in Bamboo Twig 8.5
Same name and namespace in other branches
- 8.2 bamboo_twig_token/src/TwigExtension/Token.php \Drupal\bamboo_twig_token\TwigExtension\Token::substituteToken()
- 8.3 bamboo_twig_token/src/TwigExtension/Token.php \Drupal\bamboo_twig_token\TwigExtension\Token::substituteToken()
- 8.4 bamboo_twig_token/src/TwigExtension/Token.php \Drupal\bamboo_twig_token\TwigExtension\Token::substituteToken()
Substitute a given tokens with appropriate value.
Parameters
string $token: A replaceable token.
array $data: (optional) An array of keyed objects. For simple replacement scenarios 'node', 'user', and others are common keys, with an accompanying node or user object being the value. Some token types, like 'site', do not require any explicit information from $data and can be replaced even if it is empty.
array $options: (optional) A keyed array of settings and flags to control the token replacement process.
Return value
string The token value.
See also
\Drupal\Core\Utility\Token::replace()
File
- bamboo_twig_token/
src/ TwigExtension/ Token.php, line 49
Class
- Token
- Provides a token rempalcement as Twig Extensions.
Namespace
Drupal\bamboo_twig_token\TwigExtensionCode
public function substituteToken($token, array $data = [], array $options = []) {
return $this
->getToken()
->replace("[{$token}]", $data, $options);
}