function DevelCommands::token
Same name in other branches
- 5.x src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::token()
- 5.x src/Drush/Commands/DevelCommands.php \Drupal\devel\Drush\Commands\DevelCommands::token()
List available tokens.
@command devel:token @aliases token,devel-token @field-labels group: Group token: Token name: Name @default-fields group,token,name
Return value
\Consolidation\OutputFormatters\StructuredData\RowsOfFields The tokens structured in a RowsOfFields object.
File
-
src/
Commands/ DevelCommands.php, line 224
Class
- DevelCommands
- Class DevelCommands.
Namespace
Drupal\devel\CommandsCode
public function token($options = [
'format' => 'table',
]) {
$all = $this->getToken()
->getInfo();
foreach ($all['tokens'] as $group => $tokens) {
foreach ($tokens as $key => $token) {
$rows[] = [
'group' => $group,
'token' => $key,
'name' => $token['name'],
];
}
}
return new RowsOfFields($rows);
}