diff --git a/modules/next/src/Event/EntityActionEvent.php b/modules/next/src/Event/EntityActionEvent.php index 4fddddf3..f900f4c1 100644 --- a/modules/next/src/Event/EntityActionEvent.php +++ b/modules/next/src/Event/EntityActionEvent.php @@ -75,8 +75,12 @@ public static function createFromEntity(EntityInterface $entity, string $action) $next_entity_type_manager = \Drupal::service('next.entity_type.manager'); $sites = $next_entity_type_manager->getSitesForEntity($entity); - $url = $entity->hasLinkTemplate('canonical') ? $entity->toUrl()->toString(TRUE)->getGeneratedUrl() : NULL; - + try { + $url = $entity->hasLinkTemplate('canonical') ? $entity->toUrl()->toString(TRUE)->getGeneratedUrl() : NULL; + } + catch (\Exception $e) { + $url = NULL; + } return new static($entity, $action, $sites, $url); }