public function PreviewLinkStorage::createPreviewLink in Preview Link 8
Creates a new preview link from a entity type Id and entity Id.
Parameters
string $entity_type_id: The entity type Id.
string $entity_id: The entity id.
Return value
\Drupal\preview_link\Entity\PreviewLinkInterface The preview link entity.
Overrides PreviewLinkStorageInterface::createPreviewLink
1 call to PreviewLinkStorage::createPreviewLink()
- PreviewLinkStorage::createPreviewLinkForEntity in src/
PreviewLinkStorage.php - Creates a new preview link from a content entity.
File
- src/
PreviewLinkStorage.php, line 108
Class
- PreviewLinkStorage
- Preview Link entity storage.
Namespace
Drupal\preview_linkCode
public function createPreviewLink($entity_type_id, $entity_id) {
$preview_link = $this
->create([
'entity_id' => $entity_id,
'entity_type_id' => $entity_type_id,
]);
$preview_link
->save();
return $preview_link;
}