Open hbugdoll opened 8 months ago
agree :+1: would you like to send a PR?
I would like to, but it's not clear to me yet how...
$websiteId must be provided in verifyAlias()
$websiteId
as new argument in NavItem::verifyAlias($alias, $langId, $websiteId)
...ok$websiteId
inside NavItem::validateAlias()
?
Yii::$app->website->current['id']
? Is this corresponding to currentWebsiteToggler
or to the website with is_default = 1
?NavItem
→Nav
→NavContainer
→ Website
?it must be done using:
Using a Query NavItem →Nav →NavContainer → Website
it must be done using:
Using a Query NavItem →Nav →NavContainer → Website
Is not possible, because nav_id
is not yet set for the Nav Item when validateAlias()
is called during page creating.
After https://github.com/luyadev/luya-module-cms/pull/411 we have the following situation now:
Same alias is prevented
parent_nav_id
=0
).That is the desired behavior.
But there is no support of multiple websites in
verifyAlias()
. The GROUP BY clause https://github.com/luyadev/luya-module-cms/blob/f77915060d7531f14d38af61fc0b4825cd06e805/src/models/NavItem.php#L270 doesn't reach it. In my opinion this clause can be omitted because of the presence of->exists()
.Currently, it's not possible to have two pages at root level with same alias but in different websites, because of "same"
parent_nav_id
=0
.The WHERE clause https://github.com/luyadev/luya-module-cms/blob/f77915060d7531f14d38af61fc0b4825cd06e805/src/models/NavItem.php#L269 should be something like
->where(['cms_nav_item.alias' => $alias, 'cms_nav_item.lang_id' => $langId, 'cms_nav.parent_nav_id' => $parentNavId, 'cms_nav_container.website_id' => $websiteId])
and$websiteId
must be provided inverifyAlias()
.