From 7ae9b83d19012b0f0d670fc2b95952b64469c9df Mon Sep 17 00:00:00 2001 From: Nadar Date: Wed, 21 Feb 2024 09:32:30 +0000 Subject: [PATCH 1/2] Fix parent nav id assignment in NavItem model --- src/models/NavItem.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/models/NavItem.php b/src/models/NavItem.php index 2a6aa496..007ed741 100644 --- a/src/models/NavItem.php +++ b/src/models/NavItem.php @@ -256,6 +256,9 @@ public function verifyAlias($alias, $langId) return false; } + // when no parent nav id is given, the post value is `null` therefore we have the explicit set the value to `0`. + $parentNavId = $this->parent_nav_id ?: 0; + /** * Group by website_id * @since 4.0.0 @@ -263,7 +266,7 @@ public function verifyAlias($alias, $langId) $exists = static::find() ->leftJoin('cms_nav', 'cms_nav_item.nav_id=cms_nav.id') ->leftJoin('cms_nav_container', 'cms_nav.nav_container_id=cms_nav_container.id') - ->where(['cms_nav_item.alias' => $alias, 'cms_nav_item.lang_id' => $langId, 'cms_nav.parent_nav_id' => $this->parent_nav_id]) + ->where(['cms_nav_item.alias' => $alias, 'cms_nav_item.lang_id' => $langId, 'cms_nav.parent_nav_id' => $parentNavId]) ->groupBy('cms_nav_container.website_id') ->exists(); if ($exists) { From f77915060d7531f14d38af61fc0b4825cd06e805 Mon Sep 17 00:00:00 2001 From: Nadar Date: Wed, 21 Feb 2024 09:35:30 +0000 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3e9f6c2..983c5e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE ## 5.1.1 + [#410](https://github.com/luyadev/luya-module-cms/pull/410) Disabled sorting functionality for the "group" extra field in the block CRUD interface due to an exception being thrown. This issue occurred because the field is declared as an `extraAttribute`. ++ [#409](https://github.com/luyadev/luya-module-cms/issues/409) Implemented a new validation check to prevent slug duplication within the same language and navigation hierarchy when creating a new page. This enhancement ensures unique page identification and avoids conflicts in site structure. ## 5.1.0 (7. February 2024)