Compare commits

...

2 Commits

Author SHA1 Message Date
Guy Sartorelli
5d747fa33c
Merge 00caf8d4ad into 393940195d 2024-10-17 00:14:11 +00:00
Guy Sartorelli
00caf8d4ad
API Update code to reflect changes to LeftAndMain 2024-10-17 13:13:17 +13:00
2 changed files with 6 additions and 6 deletions

View File

@ -280,7 +280,7 @@ class LeftAndMainSubsites extends Extension
// sessionNamespace() is protected - see for info
$override = $this->owner->config()->get('session_namespace');
$sessionNamespace = $override ? $override : get_class($this->owner);
$session->clear($sessionNamespace . '.currentPage');
$session->clear($sessionNamespace . '.currentRecord');
}
// Context: Subsite ID has already been set to the state via InitStateMiddleware
@ -293,7 +293,7 @@ class LeftAndMainSubsites extends Extension
$currentController = Controller::curr();
if ($currentController instanceof CMSPageEditController) {
/** @var SiteTree $page */
$page = $currentController->currentPage();
$page = $currentController->currentRecord();
// If the page exists but doesn't belong to the requested subsite, redirect to admin/pages which
// will show a list of the requested subsite's pages
@ -314,7 +314,7 @@ class LeftAndMainSubsites extends Extension
// Automatically redirect the session to appropriate subsite when requesting a record.
// This is needed to properly initialise the session in situations where someone opens the CMS via a link.
$record = $this->owner->currentPage();
$record = $this->owner->currentRecord();
if ($record
&& isset($record->SubsiteID, $this->owner->urlParams['ID'])
&& is_numeric($record->SubsiteID)
@ -379,7 +379,7 @@ class LeftAndMainSubsites extends Extension
return;
}
protected function augmentNewSiteTreeItem(&$item)
protected function updateNewItem(&$item)
{
$request = Controller::curr()->getRequest();
$item->SubsiteID = $request->postVar('SubsiteID') ?: SubsiteState::singleton()->getSubsiteId();

View File

@ -287,7 +287,7 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest
Subsite::changeSubsite($s1);
$cmsmain = CMSMain::create();
$hints = json_decode($cmsmain->SiteTreeHints() ?? '', true);
$hints = json_decode($cmsmain->TreeHints() ?? '', true);
$classes = $hints['Root']['disallowedChildren'];
$this->assertContains(ErrorPage::class, $classes);
$this->assertContains(TestClassA::class, $classes);
@ -298,7 +298,7 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest
if ($cmsmain->hasMethod('getHintsCache')) {
$cmsmain->getHintsCache()->clear();
}
$hints = json_decode($cmsmain->SiteTreeHints() ?? '', true);
$hints = json_decode($cmsmain->TreeHints() ?? '', true);
$classes = $hints['Root']['disallowedChildren'];
$this->assertNotContains(ErrorPage::class, $classes);