You are here

public function LogicalAnd::process in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/BusinessRulesCondition/LogicalAnd.php \Drupal\business_rules\Plugin\BusinessRulesCondition\LogicalAnd::process()

Process the condition.

Parameters

\Drupal\business_rules\ConditionInterface $condition: The configured condition.

\Drupal\business_rules\Events\BusinessRulesEvent $event: The event that has triggered the condition.

Return value

bool Boolean value that indicates if the condition is true.

Overrides BusinessRulesConditionPlugin::process

File

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

Class

LogicalAnd
Class LogicalOr.

Namespace

Drupal\business_rules\Plugin\BusinessRulesCondition

Code

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;
}