public function PreviewLinkHost::getPreviewLinks in Preview Link 2.x
Same name and namespace in other branches
- 2.0.x src/PreviewLinkHost.php \Drupal\preview_link\PreviewLinkHost::getPreviewLinks()
Get preview links for an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An entity.
Return value
\Drupal\preview_link\Entity\PreviewLinkInterface[] Preview links associated with an entity.
Overrides PreviewLinkHostInterface::getPreviewLinks
File
- src/
PreviewLinkHost.php, line 35
Class
- PreviewLinkHost
- Service for relationships between preview links and entities they unlock.
Namespace
Drupal\preview_linkCode
public function getPreviewLinks(EntityInterface $entity) : array {
$ids = $this->previewLinkStorage
->getQuery()
->condition('entities.target_type', $entity
->getEntityTypeId())
->condition('entities.target_id', $entity
->id())
->execute();
return $this->previewLinkStorage
->loadMultiple($ids);
}