public function EntityFieldOperationCompareType::evaluate in Entity Field Condition 2.0.x
Evaluate the entity field value.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity instance.
string $field_name: The entity field name.
Return value
bool Return TRUE if the field value compare is valid, otherwise FALSE.
Overrides EntityFieldCompareTypeInterface::evaluate
File
- src/
Plugin/ EntityFieldCondition/ CompareType/ EntityFieldOperationCompareType.php, line 79
Class
- EntityFieldOperationCompareType
- Define the entity field operation compare type plugin.
Namespace
Drupal\entity_field_condition\Plugin\EntityFieldCondition\CompareTypeCode
public function evaluate(ContentEntityInterface $entity, string $field_name) : bool {
if (!$entity
->hasField($field_name)) {
return FALSE;
}
return $this
->compareValue($this
->getEntityFieldValue($entity, $field_name));
}