public function TokensInfoEvent::getTokenTypes in Hook Event Dispatcher 8
Getter.
An associative array of token types (groups). Each token type is an associative array with the following components:
- name: The translated human-readable short name of the token type.
- description (optional): A translated longer description of the token type.
- needs-data: The type of data that must be provided to \Drupal\Core\Utility\Token::replace() in the $data argument (i.e., the key name in $data) in order for tokens of this type to be used in the $text being processed. For instance, if the token needs a node object, 'needs-data' should be 'node', and to use this token in \Drupal\Core\Utility\Token::replace(), the caller needs to supply a node object as $data['node']. Some token data can also be supplied indirectly; for instance, a node object in $data supplies a user object (the author of the node), allowing user tokens to be used when only a node data object is supplied.
Return value
array All the different token types.
File
- src/
Event/ Token/ TokensInfoEvent.php, line 81
Class
- TokensInfoEvent
- Class TokensInfoEvent.
Namespace
Drupal\hook_event_dispatcher\Event\TokenCode
public function getTokenTypes() {
return $this->tokenTypes;
}