protected function GeysirFormEntityRevisionTrait::saveParentEntityRevision in Geysir 8
Saves the revision on the parent entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The parent entity.
\Drupal\Component\Datetime\TimeInterface $time: The system time.
\Drupal\Core\Session\AccountInterface $current_user: The current user.
Return value
int Save status.
Throws
\Drupal\Core\Entity\EntityStorageException
3 calls to GeysirFormEntityRevisionTrait::saveParentEntityRevision()
- GeysirModalParagraphAddForm::save in src/
Form/ GeysirModalParagraphAddForm.php - Form submission handler for the 'save' action.
- GeysirParagraphDeleteForm::submitForm in src/
Form/ GeysirParagraphDeleteForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
- GeysirParagraphForm::save in src/
Form/ GeysirParagraphForm.php
File
- src/
Form/ GeysirFormEntityRevisionTrait.php, line 34
Class
- GeysirFormEntityRevisionTrait
- Provides the geysir forms entity revisions support.
Namespace
Drupal\geysir\FormCode
protected function saveParentEntityRevision(EntityInterface $entity, TimeInterface $time, AccountInterface $current_user) : int {
if ($entity instanceof RevisionableInterface) {
$entity
->setNewRevision();
if ($entity instanceof TranslatableRevisionableInterface) {
$entity
->setRevisionTranslationAffected(TRUE);
}
if ($entity instanceof RevisionLogInterface) {
$entity
->setRevisionCreationTime($time
->getRequestTime());
$entity
->setRevisionUserId($current_user
->id());
}
}
return $entity
->save();
}