class PreviewLinkRerouteException in Preview Link 2.0.x
Same name and namespace in other branches
- 2.x src/Exception/PreviewLinkRerouteException.php \Drupal\preview_link\Exception\PreviewLinkRerouteException
Exception thrown when an entity needs to redirect to a preview link.
Hierarchy
- class \Drupal\preview_link\Exception\PreviewLinkRerouteException extends \Drupal\preview_link\Exception\Exception implements CacheableDependencyInterface uses RefinableCacheableDependencyTrait
Expanded class hierarchy of PreviewLinkRerouteException
2 files declare their use of PreviewLinkRerouteException
- PreviewLinkCanonicalRerouteAccessCheck.php in src/
Access/ PreviewLinkCanonicalRerouteAccessCheck.php - PreviewLinkRouteEventSubscriber.php in src/
EventSubscriber/ PreviewLinkRouteEventSubscriber.php
File
- src/
Exception/ PreviewLinkRerouteException.php, line 15
Namespace
Drupal\preview_link\ExceptionView source
class PreviewLinkRerouteException extends \Exception implements CacheableDependencyInterface {
use RefinableCacheableDependencyTrait;
/**
* The entity redirecting to preview link.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
protected $entity;
/**
* The preview link redirecting to.
*
* @var \Drupal\preview_link\Entity\PreviewLinkInterface
*/
protected $previewLink;
/**
* PreviewLinkRerouteException constructor.
*
* @param string $message
* The Exception message to throw.
* @param int $code
* The Exception code.
* @param \Throwable|null $previous
* The previous throwable used for the exception chaining.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity redirecting to preview link.
* @param \Drupal\preview_link\Entity\PreviewLinkInterface $previewLink
* The preview link redirecting to.
*/
public function __construct($message, $code, ?\Throwable $previous, EntityInterface $entity, PreviewLinkInterface $previewLink) {
parent::__construct($message, $code, $previous);
$this->entity = $entity;
$this->previewLink = $previewLink;
}
/**
* Get the entity redirecting to preview link.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity redirecting to preview link.
*/
public function getEntity() : EntityInterface {
return clone $this->entity;
}
/**
* Get the preview link redirecting to.
*
* @return \Drupal\preview_link\Entity\PreviewLinkInterface
* The preview link redirecting to.
*/
public function getPreviewLink() : PreviewLinkInterface {
return clone $this->previewLink;
}
}