public function DisabledEntity::onDataTamper in Acquia Content Hub 8.2
Tamper with CDF data before its imported.
Parameters
\Drupal\acquia_contenthub\Event\EntityDataTamperEvent $event: The data tamper event.
Throws
\Exception
File
- modules/
acquia_contenthub_subscriber/ src/ EventSubscriber/ EntityDataTamper/ DisabledEntity.php, line 53
Class
- DisabledEntity
- Place auto_updated_disabled entities into the dependency stack.
Namespace
Drupal\acquia_contenthub_subscriber\EventSubscriber\EntityDataTamperCode
public function onDataTamper(EntityDataTamperEvent $event) {
$cdf = $event
->getCdf();
foreach ($cdf
->getEntities() as $object) {
$uuid = $object
->getUuid();
// @todo we want to compare by hashes eventually.
if (!$this->tracker
->isTracked($uuid)) {
continue;
}
if ($this->tracker
->getStatusByUuid($uuid) !== SubscriberTracker::AUTO_UPDATE_DISABLED) {
continue;
}
$entity = $this->tracker
->getEntityByRemoteIdAndHash($uuid);
if ($entity) {
$wrapper = new DependentEntityWrapper($entity);
$wrapper
->setRemoteUuid($uuid);
$event
->getStack()
->addDependency($wrapper);
}
}
}