Skip to content

Commit

Permalink
ENH Stop using Controller::has_curr()
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 13, 2025
1 parent 9486763 commit 323daab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Extensions/SiteTreeSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function updateCMSFields(FieldList $fields)
$subsitesMap = new Map(ArrayList::create());
}

$viewingPageHistory = Controller::has_curr() && Controller::curr() instanceof HistoryViewerController;
$viewingPageHistory = Controller::curr() instanceof HistoryViewerController;

// Master page edit field (only allowed from default subsite to avoid inconsistent relationships)
$isDefaultSubsite = $this->owner->SubsiteID == 0 || $this->owner->Subsite()->DefaultSite;
Expand Down
5 changes: 3 additions & 2 deletions src/Pages/SubsitesVirtualPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public function getCMSFields()
'ID',
'MenuTitle'
);
if (Controller::has_curr() && Controller::curr()->getRequest()) {
$subsiteID = (int) Controller::curr()->getRequest()->requestVar('CopyContentFromID_SubsiteID');
$request = Controller::curr()?->getRequest();
if ($request) {
$subsiteID = (int) $request->requestVar('CopyContentFromID_SubsiteID');
$pageSelectionField->setSubsiteID($subsiteID);
}
$fields->replaceField('CopyContentFromID', $pageSelectionField);
Expand Down

0 comments on commit 323daab

Please sign in to comment.