public function PreviewLinkStorage::save in Preview Link 8
Saves the entity permanently.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to save.
Return value
SAVED_NEW or SAVED_UPDATED is returned depending on the operation performed.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.
Overrides SqlContentEntityStorage::save
File
- src/
PreviewLinkStorage.php, line 130
Class
- PreviewLinkStorage
- Preview Link entity storage.
Namespace
Drupal\preview_linkCode
public function save(EntityInterface $entity) {
if ($entity
->regenerateToken()) {
$entity
->setToken($this
->generateUniqueToken());
}
return parent::save($entity);
}