diff --git a/src/Entity/Paragraph.php b/src/Entity/Paragraph.php index 8b2e24a..a76fe81 100644 --- a/src/Entity/Paragraph.php +++ b/src/Entity/Paragraph.php @@ -31,6 +31,7 @@ use Drupal\paragraphs\ParagraphViewBuilder; use Drupal\user\EntityOwnerInterface; use Drupal\user\UserInterface; use Drupal\views\EntityViewsData; +use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException; /** * Defines the Paragraph entity. @@ -844,4 +845,19 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface { return $summary; } + + /** + * {@inheritdoc} + */ + public function toUrl($rel = 'canonical', array $options = []) { + try { + $url = parent::toUrl($rel, $options); + } + catch (UndefinedLinkTemplateException $e) { + return ''; + } + + return $url; + } + }