You are here

class LogicalAnd in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesCondition/LogicalAnd.php \Drupal\business_rules\Plugin\BusinessRulesCondition\LogicalAnd

Class LogicalOr.

@package Drupal\business_rules\Plugin\BusinessRulesCondition

Plugin annotation


@BusinessRulesCondition(
  id = "logical_and",
  label = @Translation("Logical AND"),
  group = @Translation("Logical"),
  description = @Translation("Logical AND condition. Returns true if all inner conditions are valid. Only conditions with same target Entity and Bundles (if defined) can be included on the set."),
  reactsOnIds = {},
  isContextDependent = FALSE,
)

Hierarchy

Expanded class hierarchy of LogicalAnd

1 file declares its use of LogicalAnd
ConfigEntityCalculateDependencyTest.php in tests/src/Unit/ConfigEntityCalculateDependencyTest.php

File

src/Plugin/BusinessRulesCondition/LogicalAnd.php, line 24

Namespace

Drupal\business_rules\Plugin\BusinessRulesCondition
View source
class LogicalAnd extends ConditionSet {

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration = [], $plugin_id = 'logical_and', $plugin_definition = []) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);

    // This variable lives at ConditionSet class.
    $this->entityTypeManager = $this->util->container
      ->get('entity_type.manager');
  }

  /**
   * {@inheritdoc}
   */
  public function process(ConditionInterface $condition, BusinessRulesEvent $event) {
    $items = $condition
      ->getSettings('items');
    $items = BusinessRulesItemObject::itemsArrayToItemsObject($items);

    /** @var \Drupal\business_rules\BusinessRulesItemObject $item */
    foreach ($items as $item) {
      $c = Condition::load($item
        ->getId());
      if (!$this->processor
        ->isConditionValid($c, $event)) {
        return FALSE;
      }
    }
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BusinessRulesItemPluginBase::$processor protected property The business rules processor.
BusinessRulesItemPluginBase::$util protected property The business rules util.
BusinessRulesItemPluginBase::getDescription public function Provide a description of the item. Overrides BusinessRulesItemPluginInterface::getDescription
BusinessRulesItemPluginBase::getEditUrl public function Get the redirect url for the item edit-form route. Overrides BusinessRulesItemPluginInterface::getEditUrl
BusinessRulesItemPluginBase::getGroup public function Provide the group of the item. Overrides BusinessRulesItemPluginInterface::getGroup
BusinessRulesItemPluginBase::getRedirectUrl public function Get the redirect url for the item collection route. Overrides BusinessRulesItemPluginInterface::getRedirectUrl
BusinessRulesItemPluginBase::getVariables public function Return a variable set with all used variables on the item. Overrides BusinessRulesItemPluginInterface::getVariables 9
BusinessRulesItemPluginBase::pregMatch public function Extract the variables from the plugin settings. Overrides BusinessRulesItemPluginInterface::pregMatch
BusinessRulesItemPluginBase::processTokenArraySetting private function Helper function to process tokens if the setting is an array.
BusinessRulesItemPluginBase::processTokens public function Process the tokens on the settings property for the item. Overrides BusinessRulesItemPluginInterface::processTokens
BusinessRulesItemPluginBase::processVariables public function Process the item replacing the variables by it's values. Overrides BusinessRulesItemPluginInterface::processVariables 1
BusinessRulesItemPluginBase::validateForm public function Plugin form validator. Overrides BusinessRulesItemPluginInterface::validateForm 11
BusinessRulesItemPluginInterface::VARIABLE_REGEX constant
ConditionSet::$entityTypeManager protected property The entity type manager.
ConditionSet::$usedWeight private property We don't want to use the same wait two times for an item.
ConditionSet::buildForm public function Form constructor. Overrides BusinessRulesItemPluginBase::buildForm
ConditionSet::checkInnerCondition private static function Do not show conditionSets that already contains the main_condition.
ConditionSet::formItems public function Provide the form fields for add Business Rule's Items.
ConditionSet::generateItemWeight private function Generate the item weight.
ConditionSet::getAvailableItems public static function Return all others conditions with the same target Entity and Bundle.
ConditionSet::getSettingsForm public function Return the form array. Overrides BusinessRulesItemPluginBase::getSettingsForm
ConditionSet::processSettings public function Process the item settings before it's saved. Overrides BusinessRulesItemPluginBase::processSettings
LogicalAnd::process public function Process the condition. Overrides BusinessRulesConditionPlugin::process
LogicalAnd::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides BusinessRulesItemPluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.