public function DevelCommands::token in Devel 8.3
Same name and namespace in other branches
- 8 src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::token()
- 8.2 src/Commands/DevelCommands.php \Drupal\devel\Commands\DevelCommands::token()
- 4.x src/Commands/DevelCommands.php \Drupal\devel\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);
}