function DevelCommands::token

Same name in this branch
  1. 5.x src/Drush/Commands/DevelCommands.php \Drupal\devel\Drush\Commands\DevelCommands::token()
Same name in other branches
  1. 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 245

Class

DevelCommands
Class DevelCommands.

Namespace

Drupal\devel\Commands

Code

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);
}