You are here

interface PreviewLinkHostInterface in Preview Link 2.0.x

Same name and namespace in other branches
  1. 2.x src/PreviewLinkHostInterface.php \Drupal\preview_link\PreviewLinkHostInterface

Interface for relationships between preview links and entities they unlock.

Hierarchy

Expanded class hierarchy of PreviewLinkHostInterface

All classes that implement PreviewLinkHostInterface

2 files declare their use of PreviewLinkHostInterface
PreviewLinkAccessCheck.php in src/Access/PreviewLinkAccessCheck.php
PreviewLinkCanonicalRerouteAccessCheck.php in src/Access/PreviewLinkCanonicalRerouteAccessCheck.php

File

src/PreviewLinkHostInterface.php, line 12

Namespace

Drupal\preview_link
View source
interface PreviewLinkHostInterface {

  /**
   * Get preview links for an entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity.
   *
   * @return \Drupal\preview_link\Entity\PreviewLinkInterface[]
   *   Preview links associated with an entity.
   */
  public function getPreviewLinks(EntityInterface $entity) : array;

  /**
   * Determines if a token unlocks an entity entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity.
   * @param string[] $tokens
   *   An array of Preview Link tokens.
   *
   * @return bool
   *   Whether if at least one provided token grants access to the entity.
   */
  public function isToken(EntityInterface $entity, array $tokens) : bool;

  /**
   * Determines if an entity has any active preview links.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity.
   *
   * @return bool
   *   Whether the entity has any associated preview links.
   */
  public function hasPreviewLinks(EntityInterface $entity) : bool;

}

Members

Namesort descending Modifiers Type Description Overrides
PreviewLinkHostInterface::getPreviewLinks public function Get preview links for an entity. 1
PreviewLinkHostInterface::hasPreviewLinks public function Determines if an entity has any active preview links. 1
PreviewLinkHostInterface::isToken public function Determines if a token unlocks an entity entity. 1