You are here

public function YamlFormPluginHandlerController::index in YAML Form 8

1 string reference to 'YamlFormPluginHandlerController::index'
yamlform.routing.yml in ./yamlform.routing.yml
yamlform.routing.yml

File

src/Controller/YamlFormPluginHandlerController.php, line 49

Class

YamlFormPluginHandlerController
Controller for all form handlers.

Namespace

Drupal\yamlform\Controller

Code

public function index() {
  $definitions = $this->pluginManager
    ->getDefinitions();
  $definitions = $this->pluginManager
    ->getSortedDefinitions($definitions);
  $rows = [];
  foreach ($definitions as $plugin_id => $definition) {
    $rows[$plugin_id] = [
      $plugin_id,
      $definition['label'],
      $definition['description'],
      $definition['category'],
      $definition['cardinality'] == -1 ? $this
        ->t('Unlimited') : $definition['cardinality'],
      $definition['results'] ? $this
        ->t('Processed') : $this
        ->t('Ignored'),
      $definition['provider'],
    ];
  }
  ksort($rows);
  return [
    '#type' => 'table',
    '#header' => [
      $this
        ->t('ID'),
      $this
        ->t('Label'),
      $this
        ->t('Description'),
      $this
        ->t('Category'),
      $this
        ->t('Cardinality'),
      $this
        ->t('Results'),
      $this
        ->t('Provided by'),
    ],
    '#rows' => $rows,
    '#sticky' => TRUE,
  ];
}