protected function EntityPublisher::saveEntityWithUnpublishedStatus in Content Synchronizer 8
Same name and namespace in other branches
- 8.2 src/Service/EntityPublisher.php \Drupal\content_synchronizer\Service\EntityPublisher::saveEntityWithUnpublishedStatus()
- 3.x src/Service/EntityPublisher.php \Drupal\content_synchronizer\Service\EntityPublisher::saveEntityWithUnpublishedStatus()
Try to unpublish entity if it needs to be created. Either default save.
Parameters
\Drupal\Core\Entity\Entity $entity: The entity to save.
string $gid: THe gid.
\Drupal\Core\Entity\Entity $existingEntity: The existing entity before changes.
1 call to EntityPublisher::saveEntityWithUnpublishedStatus()
- EntityPublisher::saveEntityWithRevision in src/
Service/ EntityPublisher.php - Try to create a revision of the entity.
File
- src/
Service/ EntityPublisher.php, line 84
Class
- EntityPublisher
- THe entity publsher service.
Namespace
Drupal\content_synchronizer\ServiceCode
protected function saveEntityWithUnpublishedStatus(Entity $entity, $gid, Entity $existingEntity = NULL) {
if ($this
->isPublishable($entity)) {
if (!$entity
->id()) {
if (ImportProcessor::getCurrentImportProcessor()
->getCreationType() == ImportProcessor::PUBLICATION_UNPUBLISH) {
$entity
->setPublished(FALSE);
}
else {
$entity
->setPublished(TRUE);
}
}
}
$this
->defaultSave($entity, $existingEntity);
}