luyadev / luya-module-cms

The LUYA CMS module provides a full functional CMS for adding contents based on blocks.
https://luya.io
MIT License
33 stars 46 forks source link

Teardown with Hidden #297

Closed nadar closed 4 years ago

nadar commented 4 years ago

When using teardown() in the menu $baseItem->with('hidden')->getTeardown() hidden items should be included in the teardown() process

$parent = $this->with($this->_with)->getParent();
        $current = $this;
        $data[$current->id] = $current;
        while ($parent) {
            $data[$parent->id] = $parent;
            $parent = $parent->with($this->_with)->getParent();
        }

        return Query::createArrayIterator(array_reverse($data, true), $this->lang, $this->_with, false);

The array iterator filter seems not to have this information anymore whether to include hidden elements or not:

    public function accept()
    {
        $event = new MenuItemEvent();
        $event->item = $this->current();
        if (isset($this->getInnerIterator()->with['hidden'])) {
            $event->visible = true;
        }
        Yii::$app->menu->trigger(Menu::EVENT_ON_ITEM_FIND, $event);
        return $event->visible;
    }
 if (isset($this->getInnerIterator()->with['hidden'])) {
            $event->visible = true;
        }

should set to true, but does not. is the with information gone?