annotate core/lib/Drupal/Core/Condition/ConditionInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Condition;
Chris@0 4
Chris@18 5 use Drupal\Component\Plugin\ConfigurableInterface;
Chris@0 6 use Drupal\Component\Plugin\ConfigurablePluginInterface;
Chris@18 7 use Drupal\Component\Plugin\DependentPluginInterface;
Chris@0 8 use Drupal\Component\Plugin\PluginInspectionInterface;
Chris@0 9 use Drupal\Core\Cache\CacheableDependencyInterface;
Chris@0 10 use Drupal\Core\Executable\ExecutableInterface;
Chris@0 11 use Drupal\Core\Executable\ExecutableManagerInterface;
Chris@0 12 use Drupal\Core\Plugin\PluginFormInterface;
Chris@0 13
Chris@0 14 /**
Chris@0 15 * An interface for condition plugins.
Chris@0 16 *
Chris@0 17 * Condition plugins are context-aware and configurable. They support the
Chris@0 18 * following keys in their plugin definitions:
Chris@0 19 * - context: An array of context definitions, keyed by context name. Each
Chris@0 20 * context definition is a typed data definition describing the context. Check
Chris@0 21 * the typed data definition docs for details.
Chris@0 22 * - configuration: An array of configuration option definitions, keyed by
Chris@0 23 * option name. Each option definition is a typed data definition describing
Chris@0 24 * the configuration option. Check the typed data definition docs for details.
Chris@0 25 *
Chris@0 26 * @todo Replace the dependency on \Drupal\Core\Form\FormInterface with a new
Chris@0 27 * interface from https://www.drupal.org/node/2006248.
Chris@0 28 * @todo WARNING: The condition API is going to receive some additions before release.
Chris@0 29 * The following additions are likely to happen:
Chris@0 30 * - The way configuration is handled and configuration forms are built is
Chris@0 31 * likely to change in order for the plugin to be of use for Rules.
Chris@0 32 * - Conditions will receive a data processing API that allows for token
Chris@0 33 * replacements to happen outside of the plugin implementations,
Chris@0 34 * see https://www.drupal.org/node/2347023.
Chris@0 35 * - Conditions will have to implement access control for checking who is
Chris@0 36 * allowed to configure or perform the action at
Chris@0 37 * https://www.drupal.org/node/2172017.
Chris@0 38 *
Chris@0 39 * @see \Drupal\Core\TypedData\TypedDataManager::create()
Chris@0 40 * @see \Drupal\Core\Executable\ExecutableInterface
Chris@0 41 * @see \Drupal\Core\Condition\ConditionManager
Chris@0 42 * @see \Drupal\Core\Condition\Annotation\Condition
Chris@0 43 * @see \Drupal\Core\Condition\ConditionPluginBase
Chris@0 44 *
Chris@0 45 * @ingroup plugin_api
Chris@0 46 */
Chris@18 47 interface ConditionInterface extends ExecutableInterface, PluginFormInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginInspectionInterface, CacheableDependencyInterface {
Chris@0 48
Chris@0 49 /**
Chris@0 50 * Determines whether condition result will be negated.
Chris@0 51 *
Chris@0 52 * @return bool
Chris@0 53 * Whether the condition result will be negated.
Chris@0 54 */
Chris@0 55 public function isNegated();
Chris@0 56
Chris@0 57 /**
Chris@0 58 * Evaluates the condition and returns TRUE or FALSE accordingly.
Chris@0 59 *
Chris@0 60 * @return bool
Chris@0 61 * TRUE if the condition has been met, FALSE otherwise.
Chris@0 62 */
Chris@0 63 public function evaluate();
Chris@0 64
Chris@0 65 /**
Chris@0 66 * Provides a human readable summary of the condition's configuration.
Chris@0 67 */
Chris@0 68 public function summary();
Chris@0 69
Chris@0 70 /**
Chris@0 71 * Sets the executable manager class.
Chris@0 72 *
Chris@0 73 * @param \Drupal\Core\Executable\ExecutableManagerInterface $executableManager
Chris@0 74 * The executable manager.
Chris@0 75 */
Chris@0 76 public function setExecutableManager(ExecutableManagerInterface $executableManager);
Chris@0 77
Chris@0 78 }