Commit 0c5ebea2 authored by alexpott's avatar alexpott

Issue #1920822 by tim.plunkett: Decouple ExecutableInterface from Conditions and FormInterface.

parent 0bed623a
......@@ -8,13 +8,28 @@
namespace Drupal\Core\Condition;
use Drupal\Core\Executable\ExecutableInterface;
use Drupal\Core\Executable\ExecutableManagerInterface;
use Drupal\Core\Form\FormInterface;
/**
* An interface for condition plugins.
*
* Condition plugins are context-aware and configurable. They support the
* following keys in their plugin definitions:
* - context: An array of context definitions, keyed by context name. Each
* context definition is a typed data definition describing the context. Check
* the typed data definition docs for details.
* - configuration: An array of configuration option definitions, keyed by
* option name. Each option definition is a typed data definition describing
* the configuration option. Check the typed data definition docs for details.
*
* @todo Replace the dependency on \Drupal\Core\Form\FormInterface with a new
* interface from https://drupal.org/node/2006248.
*
* @see \Drupal\Core\TypedData\TypedDataManager::create()
* @see \Drupal\Core\Executable\ExecutableInterface
*/
interface ConditionInterface extends ExecutableInterface {
interface ConditionInterface extends ExecutableInterface, FormInterface {
/**
* Determines whether condition result will be negated.
......@@ -32,4 +47,17 @@ public function isNegated();
*/
public function evaluate();
/**
* Provides a human readable summary of the condition's configuration.
*/
public function summary();
/**
* Sets the executable manager class.
*
* @param \Drupal\Core\Executable\ExecutableManagerInterface $executableManager
* The executable manager.
*/
public function setExecutableManager(ExecutableManagerInterface $executableManager);
}
......@@ -7,41 +7,14 @@
namespace Drupal\Core\Executable;
use Drupal\Component\Plugin\ContextAwarePluginInterface;
use Drupal\Core\Form\FormInterface;
/**
* An interface for executable plugins.
*
* Executable plugins are context-aware and configurable. They support the
* following keys in their plugin definitions:
* - context: An array of context definitions, keyed by context name. Each
* context definition is a typed data definition describing the context. Check
* the typed data definition docs for details.
* - configuration: An array of configuration option definitions, keyed by
* option name. Each option definition is a typed data definition describing
* the configuration option. Check the typed data definition docs for details.
*
* @see \Drupal\Core\TypedData\TypedDataManager::create()
*/
interface ExecutableInterface extends ContextAwarePluginInterface, FormInterface {
interface ExecutableInterface {
/**
* Executes the plugin.
*/
public function execute();
/**
* Provides a human readable summary of the executable's configuration.
*/
public function summary();
/**
* Sets the executable manager class.
*
* @param \Drupal\Core\Condition\ConditionManager $executableManager
* The executable manager.
*/
public function setExecutableManager(ExecutableManagerInterface $executableManager);
}
......@@ -24,7 +24,7 @@ abstract class ExecutablePluginBase extends ContextAwarePluginBase implements Ex
protected $executableManager;
/**
* Implements \Drupal\Core\Executable\ExecutableInterace::setExecutableManager().
* {@inheritdoc}
*/
public function setExecutableManager(ExecutableManagerInterface $executableManager) {
$this->executableManager = $executableManager;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment