public function EntityField::evaluate in Entity Field Condition 2.0.x
Evaluates the condition and returns TRUE or FALSE accordingly.
Return value
bool TRUE if the condition has been met, FALSE otherwise.
Overrides ConditionInterface::evaluate
File
- src/
Plugin/ Condition/ EntityField.php, line 438
Class
- EntityField
- Define the entity field condition base class.
Namespace
Drupal\entity_field_condition\Plugin\ConditionCode
public function evaluate() : bool {
$verdict = FALSE;
$field_name = $this
->getEntityFieldName();
$compare_type = $this
->getEntityFieldCompareType();
if (isset($field_name, $compare_type) && $this
->hasEntityContext()) {
$verdict = $compare_type
->evaluate($this
->getContextValue('entity'), $field_name);
}
return $this
->isNegated() ? !$verdict : $verdict;
}