/** * @param StructureInterface $menu */ public function onClose($menu) { $uri = $menu->getUri(); $this->last = $this->cache[$menu->id]->setUri($uri); if ($menu->hasChildren()) { $this->last->setClass('has-children'); } if ($menu->isActive()) { $this->last->setActive(true); } if (!empty($uri) && $uri[0] !== '#') { $this->last->set('changefreq', 'always'); } }
/** * Get form for menu-item structure * * @param \Menu\Model\Menu\StructureInterface $structure * @return \Zend\Form\Form */ protected function getForm(StructureInterface $structure) { /* @var $form \Zend\Form\Form */ /* @var $type \Zend\Form\Form */ $service = $this->getServiceLocator()->get('Form'); $form = $service->create('Grid\\Menu\\Meta\\Base'); $meta = $service->get('Grid\\Menu\\Meta\\Type'); $type = $structure->getType(); if ($meta->has($type)) { foreach ($meta->get($type) as $element) { $form->add(clone $element); } } $form->add(array('type' => 'Zork\\Form\\Element\\Submit', 'name' => 'save', 'attributes' => array('value' => 'menu.form.submit'))); $form->setHydrator($this->getModel()->getMapper())->bind($structure); return $form; }
/** * Set inner menu * * @param \Menu\Model\Menu\StructureInterface $menu * @return \Menu\Model\Paragraph\Structure\Menu */ public function setMenu(MenuStructureInterface $menu) { $this->_menu = $menu; $this->menuId = $menu->getId(); return $this; }