public function PluginUIBase::form

Implements \Drupal\system\Plugin\PluginUIInterface::form().

Overrides PluginUIInterface::form

1 method overrides PluginUIBase::form()
BlockPluginUI::form in drupal/core/modules/block/lib/Drupal/block/Plugin/PluginUI/BlockPluginUI.php
Overrides \Drupal\system\Plugin\PluginUIBase::form().

File

drupal/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php, line 23
Contains \Drupal\system\Plugin\PluginUIBase.

Class

PluginUIBase
Provides defaults for creating user interfaces for plugins of a given type.

Namespace

Drupal\system\Plugin

Code

public function form($form, &$form_state) {
  $plugin_definition = $this
    ->getPluginDefinition();

  // @todo Find out how to let the manager be injected into the class.
  if (class_exists($plugin_definition['manager'])) {
    $manager = new $plugin_definition['manager']();
  }
  else {
    $manager = drupal_container()
      ->get($plugin_definition['manager']);
  }
  $plugins = $manager
    ->getDefinitions();
  $rows = array();
  foreach ($plugins as $plugin_id => $display_plugin_definition) {
    $rows[] = $this
      ->row($plugin_id, $display_plugin_definition);
  }
  $form['plugins'] = array(
    '#theme' => 'table',
    '#header' => $this
      ->tableHeader(),
    '#rows' => $rows,
  );
  return $form;
}