From dc13b64b1a92c40d0c271b75c4c1b9ff2f5c42bf Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 15 Aug 2024 16:21:58 +1200 Subject: [PATCH] API Update method signature for CMSEditLink --- src/ChangeSetItem.php | 12 ++---------- src/RestoreAction.php | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/ChangeSetItem.php b/src/ChangeSetItem.php index 6811a783..2a1b0880 100644 --- a/src/ChangeSetItem.php +++ b/src/ChangeSetItem.php @@ -531,18 +531,10 @@ public function getPreviewLinks() return $links; } - /** - * Get edit link for this item - * - * @return string - */ - public function CMSEditLink() + public function CMSEditLink(): ?string { $link = $this->getObjectInStage(Versioned::DRAFT); - if ($link instanceof CMSPreviewable) { - return $link->CMSEditLink(); - } - return null; + return $link->CMSEditLink(); } /** diff --git a/src/RestoreAction.php b/src/RestoreAction.php index a9739edc..678cb6ba 100644 --- a/src/RestoreAction.php +++ b/src/RestoreAction.php @@ -88,9 +88,9 @@ public static function getRestoreMessage($originalItem, $restoredItem, $changedL $restoredID = $restoredItem->Title ?: $restoredItem->ID; $restoredType = strtolower($restoredItem->i18n_singular_name() ?? ''); - if (method_exists($restoredItem, 'CMSEditLink') && - $restoredItem->CMSEditLink()) { - $restoredID = sprintf('%s', $restoredItem->CMSEditLink(), $restoredID); + $editLink = $restoredItem->CMSEditLink(); + if ($editLink) { + $restoredID = sprintf('%s', $editLink, $restoredID); } if ($originalItem->URLSegment !== $restoredItem->URLSegment) {