Skip to content

Commit

Permalink
API Update method signature for CMSEditLink
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 15, 2024
1 parent a8522c9 commit dc13b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions src/ChangeSetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/RestoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<a href="%s">%s</a>', $restoredItem->CMSEditLink(), $restoredID);
$editLink = $restoredItem->CMSEditLink();
if ($editLink) {
$restoredID = sprintf('<a href="%s">%s</a>', $editLink, $restoredID);
}

if ($originalItem->URLSegment !== $restoredItem->URLSegment) {
Expand Down

0 comments on commit dc13b64

Please sign in to comment.