function EntityHasField::doEvaluate

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 45

Class

EntityHasField
Provides a 'Entity has field' condition.

Namespace

Drupal\rules\Plugin\Condition

Code

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