Closed uso5 closed 8 years ago
So you would like to do something like this:
foreach(Yii::$app->menu->findAll(['parent_nav_id' => 0]) as $item) {
$item->hasProperty('nameOf'); // returns bool
$item->getProperty('nameOf'); // returns the value (otherwise false)
$item->getProperties(); // returns the objects
}
am i right?
@nadar you are right, thats what i am looking for.
Hi @uso5 i just implemented what you where looking for, sorry for the delay.
https://github.com/luyadev/luya/blob/master/docs/guide1.0/app-cmsproperties.md#in-menus
This will give you the ability to get the properties for the item. thanks for your feedback! indeed a very powerfull possbility. It even allows us to drop the Yii::$app->page->getProperty(...)
as this is equals to new Yii::$app->menu->current->getProperty(...)
.
Hi @nadar . Thank you for implementation. Looks very useful. I will use it 👍
I queried all menu items lets say with
Yii::$app->menu->find()->where(['parent_nav_id' => 0, 'is_active' => 1])->all()
I created page property - thumbnail image. Right now it is only possible to get additional properties to current page. I need to find this property to all menu items. Is it possible to implement?