Skip to content
Snippets Groups Projects

Issue #3497561: Change paragraph delete form cancel url

1 file
+ 1
4
Compare changes
  • Side-by-side
  • Inline
@@ -46,10 +46,7 @@ class ParagraphDeleteForm extends ParagraphDeleteFormBase {
@@ -46,10 +46,7 @@ class ParagraphDeleteForm extends ParagraphDeleteFormBase {
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public function getCancelUrl() {
public function getCancelUrl() {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
return Url::fromRoute('frontend_editing.form', ['type' => 'paragraph', 'id' => $this->getEntity()->id()]);
$paragraph = $this->getEntity();
$entity = $this->lineageInspector()->getRootParent($paragraph);
return $entity->hasLinkTemplate('canonical') ? $entity->toUrl() : Url::fromRoute('<front>');
}
}
}
}
Loading