You are here

public function VariableDataComparison::process in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesCondition/VariableDataComparison.php \Drupal\business_rules\Plugin\BusinessRulesCondition\VariableDataComparison::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/VariableDataComparison.php, line 94

Class

VariableDataComparison
Class VariableDataComparison.

Namespace

Drupal\business_rules\Plugin\BusinessRulesCondition

Code

public function process(ConditionInterface $condition, BusinessRulesEvent $event) {
  $value_1 = $condition
    ->getSettings('value_1');
  $value_2 = $condition
    ->getSettings('value_2');
  $operator = $condition
    ->getSettings('operator');
  $event_variables = $event
    ->getArgument('variables');

  // Process values variables.
  $value_1 = $this
    ->processVariables($value_1, $event_variables);
  $value_2 = $this
    ->processVariables($value_2, $event_variables);

  // Remove tags, trim and to lowercase.
  $value_1 = strip_tags(strtolower(trim($value_1)));
  $value_2 = strip_tags(strtolower(trim($value_2)));
  return $this->util
    ->criteriaMet($value_1, $operator, $value_2);
}