You are here

public function KeyCommands::typeList in Key 8

Display a list of available key types.

@command key:type-list @option group An optional key type group on which to filter. @aliases key-type-list @format table

File

src/Commands/KeyCommands.php, line 290

Class

KeyCommands
Class KeyCommands.

Namespace

Drupal\key\Commands

Code

public function typeList($options = [
  'group' => NULL,
]) {
  $result = [];
  $group = $options['group'];
  $plugins = $this->keyTypePluginManager
    ->getDefinitions();
  foreach ($plugins as $id => $plugin) {
    if (!isset($group) || $plugin['group'] == $group) {
      $row = [];
      $row['id'] = $id;
      $row['description'] = $plugin['description'];
      $result[$id] = $row;
    }
  }
  return new RowsOfFields($result);
}