abstract class ConditionPluginBase

Provides a basis for fulfilling contexts for condition plugins.

Hierarchy

Expanded class hierarchy of ConditionPluginBase

3 files declare their use of ConditionPluginBase
Language.php in drupal/core/modules/language/lib/Drupal/language/Plugin/Condition/Language.php
Contains \Drupal\language\Plugin\Condition\Language.
NodeType.php in drupal/core/modules/node/lib/Drupal/node/Plugin/Condition/NodeType.php
Contains \Drupal\node\Plugin\Condition\NodeType.
Php.php in drupal/core/modules/php/lib/Drupal/php/Plugin/Condition/Php.php
Contains \Drupal\php\Plugin\Condition\Php.

File

drupal/core/lib/Drupal/Core/Condition/ConditionPluginBase.php, line 15
Contains \Drupal\Core\Condition\ConditionPluginBase.

Namespace

Drupal\Core\Condition
View source
abstract class ConditionPluginBase extends ExecutablePluginBase implements ConditionInterface {

  /**
   * Implements \Drupal\Core\Form\FormInterface::getFormID().
   */
  public function getFormID() {
    $definition = $this
      ->getPluginDefinition();
    return implode('_', array(
      $definition['module'],
      $definition['id'],
      'condition',
    ));
  }

  /**
   * Implements \Drupal\condition\Plugin\ConditionInterface::isNegated().
   */
  public function isNegated() {
    return !empty($this->configuration['negate']);
  }

  /**
   * Implements \Drupal\Core\Form\FormInterface::buildForm().
   */
  public function buildForm(array $form, array &$form_state) {
    $form['negate'] = array(
      '#type' => 'checkbox',
      '#title' => t('Negate the condition.'),
      '#default_value' => isset($this->configuration['negate']) ? $this->configuration['negate'] : FALSE,
    );
    return $form;
  }

  /**
   * Implements \Drupal\Core\Form\FormInterface::validateForm().
   */
  public function validateForm(array &$form, array &$form_state) {
  }

  /**
   * Implements \Drupal\Core\Form\FormInterface::submitForm().
   */
  public function submitForm(array &$form, array &$form_state) {
    $this->configuration['negate'] = $form_state['values']['negate'];
  }

  /**
   * Implements \Drupal\Core\Executable\ExecutablePluginBase::execute().
   */
  public function execute() {
    return $this->executableManager
      ->execute($this);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConditionInterface::evaluate public function Evaluates the condition and returns TRUE or FALSE accordingly. 3
ConditionInterface::summary public function Provides a human readable summary of the condition's configuration. 3
ConditionPluginBase::buildForm public function Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides FormInterface::buildForm 3
ConditionPluginBase::execute public function Implements \Drupal\Core\Executable\ExecutablePluginBase::execute(). Overrides ExecutableInterface::execute
ConditionPluginBase::getFormID public function Implements \Drupal\Core\Form\FormInterface::getFormID(). Overrides FormInterface::getFormID
ConditionPluginBase::isNegated public function Implements \Drupal\condition\Plugin\ConditionInterface::isNegated(). Overrides ConditionInterface::isNegated
ConditionPluginBase::submitForm public function Implements \Drupal\Core\Form\FormInterface::submitForm(). Overrides FormInterface::submitForm 3
ConditionPluginBase::validateForm public function Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface::validateForm 1
ContextAwarePluginBase::$context protected property The data objects representing the context of this plugin.
ContextAwarePluginBase::getContext public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContext(). Overrides ContextAwarePluginInterface::getContext
ContextAwarePluginBase::getContextDefinition public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextDefinition(). Overrides ContextAwarePluginInterface::getContextDefinition
ContextAwarePluginBase::getContextDefinitions public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextDefinitions(). Overrides ContextAwarePluginInterface::getContextDefinitions
ContextAwarePluginBase::getContexts public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContexts(). Overrides ContextAwarePluginInterface::getContexts
ContextAwarePluginBase::getContextValue public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextValue(). Overrides ContextAwarePluginInterface::getContextValue
ContextAwarePluginBase::getContextValues public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextValues(). Overrides ContextAwarePluginInterface::getContextValues
ContextAwarePluginBase::setContextValue public function Override of \Drupal\Component\Plugin\ContextAwarePluginBase::setContextValue(). Overrides ContextAwarePluginBase::setContextValue
ContextAwarePluginBase::validateContexts public function Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::valdidateContexts(). Overrides ContextAwarePluginInterface::validateContexts
ContextAwarePluginBase::__construct public function Override of \Drupal\Component\Plugin\ContextAwarePluginBase::__construct(). Overrides ContextAwarePluginBase::__construct
ExecutablePluginBase::$executableManager protected property The condition manager to proxy execute calls through.
ExecutablePluginBase::getConfig public function Gets all configuration values.
ExecutablePluginBase::getConfigDefinition public function Gets the definition of a configuration option.
ExecutablePluginBase::getConfigDefinitions public function Gets an array of definitions of available configuration options.
ExecutablePluginBase::setConfig public function Sets the value of a particular configuration option.
ExecutablePluginBase::setExecutableManager public function
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId