From 983d07be2de31024b360d5bb1c3038afeb3325e3 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Thu, 15 Aug 2013 10:28:36 -0700 Subject: [PATCH] Issue #2056513 follow-up by tim.plunkett: REALLY remove PluginUI subsystem. --- .../lib/Drupal/system/Plugin/PluginUIBase.php | 96 ------------------- .../system/Plugin/PluginUIInterface.php | 52 ---------- 2 files changed, 148 deletions(-) delete mode 100644 core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php delete mode 100644 core/modules/system/lib/Drupal/system/Plugin/PluginUIInterface.php diff --git a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php b/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php deleted file mode 100644 index 077ee5bc7ce9..000000000000 --- a/core/modules/system/lib/Drupal/system/Plugin/PluginUIBase.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\system\Plugin\PluginUIBase. - */ - -namespace Drupal\system\Plugin; - -use Drupal\Component\Plugin\PluginBase; -use Drupal\Component\Plugin\Discovery\DiscoveryInterface; - -/** - * Provides defaults for creating user interfaces for plugins of a given type. - * - * @todo This class needs more documetation and/or @see references. - */ -abstract class PluginUIBase extends PluginBase implements PluginUIInterface { - - /** - * Implements \Drupal\system\Plugin\PluginUIInterface::form(). - */ - 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; - } - - /** - * Implements \Drupal\system\Plugin\PluginUIInterface::formValidate(). - */ - public function formValidate($form, &$form_state) { - } - - /** - * Implements \Drupal\system\Plugin\PluginUIInterface::formSumbit(). - */ - public function formSubmit($form, &$form_state) { - } - - /** - * Checks access for plugins of this type. - * - * @return bool - * Returns TRUE if plugins of this type can be accessed. - */ - public function access() { - $definition = $this->getPluginDefinition(); - return call_user_func_array($definition['access_callback'], $definition['access_arguments']); - } - - /** - * Displays a plugin row for configuring plugins in the user interface. - * - * @param string $display_plugin_id - * The ID of the specific plugin definition being passed to us. - * @param array $display_plugin_definition - * The plugin definition associated with the passed $plugin_id. - * - * @return array - * An array that represents a table row in the final user interface output. - */ - public function row($display_plugin_id, array $display_plugin_definition) { - $plugin_definition = $this->getPluginDefinition(); - return array($display_plugin_definition['title'], l($plugin_definition['link_title'], $plugin_definition['config_path'] . '/' . $display_plugin_id)); - } - - /** - * Provides a theme_table compatible array of headers. - * - * @return array - * A theme_table compatible array of headers. - */ - public function tableHeader() { - return array(t('Title'), t('Operations')); - } - -} diff --git a/core/modules/system/lib/Drupal/system/Plugin/PluginUIInterface.php b/core/modules/system/lib/Drupal/system/Plugin/PluginUIInterface.php deleted file mode 100644 index 9bc762995c55..000000000000 --- a/core/modules/system/lib/Drupal/system/Plugin/PluginUIInterface.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\system\Plugin\PluginUIInterface. - */ - -namespace Drupal\system\Plugin; - -/** - * Defines an interface for Plugin UI plugins. - * - * @todo This needs a lot more explanation. - */ -interface PluginUIInterface { - - /** - * Creates a form array. - * - * @param array $form - * An associative array containing the structure of the form. - * @param array $form_state - * An associative array containing the current state of the form. - * - * @return array - * Returns the form structure as an array. - * - * @todo Creates a form array for what? - */ - public function form($form, &$form_state); - - /** - * Validates form values from the form() method. - * - * @param array $form - * An associative array containing the structure of the form. - * @param array $form_state - * An associative array containing the current state of the form. - */ - public function formValidate($form, &$form_state); - - /** - * Submits form values from the form() method. - * - * @param array $form - * An associative array containing the structure of the form. - * @param array $form_state - * An associative array containing the current state of the form. - */ - public function formSubmit($form, &$form_state); - -} -- GitLab