Skip to content

Commit

Permalink
version 3.0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Aug 12, 2020
1 parent cbd4b50 commit b3c2e47
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.0.13.1 - 2020-08-12

### Fixed
- Fixed potential issue with migration.

## 3.0.13 - 2020-08-12

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "verbb/cp-nav",
"description": "Control Panel Nav helps you managing your Control Panel navigation.",
"type": "craft-plugin",
"version": "3.0.13",
"version": "3.0.13.1",
"keywords": [
"craft",
"cms",
Expand Down
24 changes: 13 additions & 11 deletions src/migrations/m200812_000000_fix_layoutid.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@ public function safeUp()
// Remove `layoutId` and add `layout` for its UID
$navs = Craft::$app->getProjectConfig()->get(NavigationsService::CONFIG_NAVIGATION_KEY);

foreach ($navs as $navUid => $nav) {
$layoutId = ArrayHelper::remove($nav, 'layoutId');
if (is_array($navs)) {
foreach ($navs as $navUid => $nav) {
$layoutId = ArrayHelper::remove($nav, 'layoutId');

if (!$layoutId) {
continue;
}
if (!$layoutId) {
continue;
}

$layout = CpNav::$plugin->getLayouts()->getLayoutById($layoutId);
$layout = CpNav::$plugin->getLayouts()->getLayoutById($layoutId);

if (!$layout) {
continue;
}
if (!$layout) {
continue;
}

$nav['layout'] = $layout->uid;
$nav['layout'] = $layout->uid;

Craft::$app->getProjectConfig()->set(NavigationsService::CONFIG_NAVIGATION_KEY . '.' . $navUid, $nav);
Craft::$app->getProjectConfig()->set(NavigationsService::CONFIG_NAVIGATION_KEY . '.' . $navUid, $nav);
}
}

return true;
Expand Down
8 changes: 5 additions & 3 deletions src/migrations/m200812_100000_layout_sortorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ public function safeUp()

$sortOrder = 0;

foreach ($layouts as $layoutUid => $layout) {
$layout['sortOrder'] = ++$sortOrder;
if (is_array($layouts)) {
foreach ($layouts as $layoutUid => $layout) {
$layout['sortOrder'] = ++$sortOrder;

Craft::$app->getProjectConfig()->set(LayoutsService::CONFIG_LAYOUT_KEY . '.' . $layoutUid, $layout);
Craft::$app->getProjectConfig()->set(LayoutsService::CONFIG_LAYOUT_KEY . '.' . $layoutUid, $layout);
}
}

return true;
Expand Down

0 comments on commit b3c2e47

Please sign in to comment.