You are here

protected function EntityHasField::doEvaluate in Rules 8.3

Checks if a given entity has a given field.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity to check for the provided field.

string $field: The field to check for on the entity.

Return value

bool TRUE if the provided entity has the provided field.

File

src/Plugin/Condition/EntityHasField.php, line 44

Class

EntityHasField
Provides a 'Entity has field' condition.

Namespace

Drupal\rules\Plugin\Condition

Code

protected function doEvaluate(FieldableEntityInterface $entity, $field) {
  return $entity
    ->hasField($field);
}