public function Token::getGlobalTokenTypes in Token 8
Get a list of token types that can be used without any context (global).
Return value
array[] An array of global token types.
Overrides TokenInterface::getGlobalTokenTypes
1 call to Token::getGlobalTokenTypes()
- Token::getInvalidTokensByContext in src/
Token.php - Validate tokens in raw text based on possible contexts.
File
- src/
Token.php, line 119
Class
- Token
- Service to retrieve token information.
Namespace
Drupal\tokenCode
public function getGlobalTokenTypes() {
if (empty($this->globalTokenTypes)) {
$token_info = $this
->getInfo();
foreach ($token_info['types'] as $type => $type_info) {
// If the token types has not specified that 'needs-data' => TRUE, then
// it is a global token type that will always be replaced in any context.
if (empty($type_info['needs-data'])) {
$this->globalTokenTypes[] = $type;
}
}
}
return $this->globalTokenTypes;
}