You are here

public function EntityContentBase::isEntityValidationRequired in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::isEntityValidationRequired()
  2. 9 core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php \Drupal\migrate\Plugin\migrate\destination\EntityContentBase::isEntityValidationRequired()

Returns a state of whether an entity needs to be validated before saving.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity to check for required validation.

Return value

bool A state of whether an entity needs to be validated.

Overrides MigrateValidatableEntityInterface::isEntityValidationRequired

1 call to EntityContentBase::isEntityValidationRequired()
EntityContentBase::import in core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php

File

core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php, line 192

Class

EntityContentBase
Provides destination class for all content entities lacking a specific class.

Namespace

Drupal\migrate\Plugin\migrate\destination

Code

public function isEntityValidationRequired(FieldableEntityInterface $entity) {

  // Prioritize the entity method over migration config because it won't be
  // possible to save that entity unvalidated.

  /* @see \Drupal\Core\Entity\ContentEntityBase::preSave() */
  return $entity
    ->isValidationRequired() || !empty($this->configuration['validate']);
}