/** * * @param string $tag - menu namespace, like "top_nave" * @param int $x - x-coordinate of item * @param int $y - y-coordinate of item * @param array|MenuContainer $arrMenuFields */ public function AddToCollection($tag, $x, $y, $arrMenuFields) { $oMenu = $this->GetFromCollection($tag, $x, $y); $bNewMenuIsObj = $arrMenuFields instanceof \Av\Component\Menu\MenuContainer; $bOldMenuIsObj = $oMenu instanceof \Av\Component\Menu\MenuContainer; if ($bOldMenuIsObj == false) { /* * replace at the position */ $this->_menu_collection[$tag][$x][$y] = $bNewMenuIsObj ? $arrMenuFields : new MenuContainer($arrMenuFields); } else { /* * change resource/dinamic only */ $oMenu->SetMenuRes($bNewMenuIsObj ? $arrMenuFields->GetMenuRes() : $arrMenuFields); $oMenu->SetMenuDynamic($bNewMenuIsObj ? $arrMenuFields->GetMenuDynamic() : $arrMenuFields); } }