Closed hbugdoll closed 3 years ago
One shouldn't use Yii::$app->menu->current
inside blocks, right?
It obviously points to the homepage, but not to the current page.
Current should always Point to the current menu item, while homepage points to the homepage. If current always points to the same page, i think its due to caching of the block itself
Thanks for the text update @hbugdoll once again!
Current should always Point to the current menu item, while homepage points to the homepage. If current always points to the same page, i think its due to caching of the block itself
I was not precisely enough in usage of current
.
And after some research it becomes clearer:
Yii::$app->menu->current
points to the current menu item in frontend, but not inside backend's admin()
.
In this case Menu::resolveCurrent()
calls Menu::getHome()
:
https://github.com/luyadev/luya-module-cms/blob/a2697808f1ac261dbad79594138b5807e8ec942d/src/Menu.php#L522-L532
minor improvements