Skip to content

Commit

Permalink
Fix an error when trying to create a navigation on a non-multi-site
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed May 6, 2022
1 parent 0cd2e92 commit cc7a67f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/controllers/NavsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ public function actionSaveNav(): ?Response
foreach (Craft::$app->getSites()->getAllSites() as $site) {
$postedSettings = $request->getBodyParam('sites.' . $site->handle);

// Skip disabled sites if this is a multi-site install
if (Craft::$app->getIsMultiSite() && empty($postedSettings['enabled'])) {
continue;
}

$siteSettings = new Nav_SiteSettings();
$siteSettings->siteId = $site->id;
$siteSettings->enabled = $postedSettings['enabled'];

// Enabled by default, particularly for non-multi-sites
$siteSettings->enabled = $postedSettings['enabled'] ?? true;

$allSiteSettings[$site->id] = $siteSettings;
}
Expand Down

0 comments on commit cc7a67f

Please sign in to comment.