Skip to content

Commit

Permalink
Fix an error when saving or creating layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Jun 24, 2024
1 parent 1dceaed commit 0b1eb03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/LayoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function actionNew(): Response
$layout = new Layout();
$layout->name = $this->request->getRequiredParam('name');
$layout->isDefault = false;
$layout->permissions = $this->request->getParam('permissions');
$layout->permissions = $this->request->getParam('permissions') ?: [];

if (!CpNav::$plugin->getLayouts()->saveLayout($layout)) {
return $this->asModelFailure($layout, Craft::t('cp-nav', 'Couldn’t save layout.'), 'layout');
Expand Down Expand Up @@ -104,7 +104,7 @@ public function actionSave(): Response

$layout->name = $this->request->getRequiredParam('name');
$layout->isDefault = false;
$layout->permissions = $this->request->getParam('permissions');
$layout->permissions = $this->request->getParam('permissions') ?: [];

if (!CpNav::$plugin->getLayouts()->saveLayout($layout)) {
return $this->asModelFailure($layout, Craft::t('cp-nav', 'Couldn’t save layout.'), 'layout');
Expand Down

0 comments on commit 0b1eb03

Please sign in to comment.