function DevelTokenCommand::__invoke
Lists the available tokens.
File
-
src/
Command/ DevelTokenCommand.php, line 35
Class
- DevelTokenCommand
- Lists the available tokens.
Namespace
Drupal\devel\CommandCode
public function __invoke(OutputInterface $output, #[Option('The output format: table, json or yaml.')] string $format = 'table') : int {
$rows = [];
foreach ($this->token
->getInfo()['tokens'] as $group => $tokens) {
foreach ($tokens as $key => $token) {
$rows[] = [
'group' => $group,
'token' => $key,
'name' => (string) $token['name'],
];
}
}
$this->writeRows($output, $rows, [
'group' => 'Group',
'token' => 'Token',
'name' => 'Name',
], $format);
return Command::SUCCESS;
}