/** * @param $site * @return $this */ protected function addMenuItems($site) { $pageRoot = $this->db->getRepository('\\Fraym\\Menu\\Entity\\MenuItem')->findOneById(1); /** * 404 Page */ $newPage = new \Fraym\Menu\Entity\MenuItem(); $newPage->site = $site; $newPage->caching = true; $newPage->https = false; $newPage->checkPermission = false; $newPage->is404 = true; $newPage->parent = $pageRoot; $newPageTranslation = new \Fraym\Menu\Entity\MenuItemTranslation(); $newPageTranslation->menuItem = $newPage; $newPageTranslation->visible = false; $newPageTranslation->active = true; $newPageTranslation->title = $this->translation->autoTranslation('404 Page not found', 'en', $this->locale->getLocale()->locale); $newPageTranslation->subtitle = ''; $newPageTranslation->url = '/' . $this->translation->autoTranslation('error', 'en', $this->locale->getLocale()->locale) . '-404'; $newPageTranslation->description = $this->translation->autoTranslation('404 Page not found', 'en', $this->locale->getLocale()->locale); $newPageTranslation->externalUrl = false; $this->db->persist($newPageTranslation); $this->db->flush(); $this->db->clear(); return $this; }
private function addMenuItems($site) { $gp = $this->request->getGPAsObject(); /** * Root Page */ $pageRoot = new \Fraym\Menu\Entity\MenuItem(); $pageRoot->site = $site; $pageRoot->caching = true; $pageRoot->visible = true; $pageRoot->active = true; $pageRoot->https = false; $pageRoot->checkPermission = false; $pageRoot->is404 = false; $pageRootTranslation = new \Fraym\Menu\Entity\MenuItemTranslation(); $pageRootTranslation->menuItem = $pageRoot; $pageRootTranslation->title = $this->translation->autoTranslation('Home', 'en', $gp->locale); $pageRootTranslation->subtitle = $this->translation->autoTranslation('Welcome to my website.', 'en', $gp->locale); $pageRootTranslation->url = ""; $pageRootTranslation->shortDescription = $this->translation->autoTranslation('My short website description', 'en', $gp->locale); $pageRootTranslation->longDescription = $this->translation->autoTranslation('My long website description', 'en', $gp->locale); $pageRootTranslation->externalUrl = false; $this->db->persist($pageRootTranslation); /** * 404 Page */ $newPage = new \Fraym\Menu\Entity\MenuItem(); $newPage->site = $site; $newPage->caching = true; $newPage->visible = false; $newPage->active = true; $newPage->https = false; $newPage->checkPermission = false; $newPage->is404 = true; $newPage->parent = $pageRoot; $newPageTranslation = new \Fraym\Menu\Entity\MenuItemTranslation(); $newPageTranslation->menuItem = $newPage; $newPageTranslation->title = $this->translation->autoTranslation('404 Page not found', 'en', $gp->locale); $newPageTranslation->subtitle = ''; $newPageTranslation->url = '/' . $this->translation->autoTranslation('error', 'en', $gp->locale) . '-404'; $newPageTranslation->shortDescription = $this->translation->autoTranslation('404 Page not found', 'en', $gp->locale); $newPageTranslation->longDescription = $this->translation->autoTranslation('404 Page not found', 'en', $gp->locale); $newPageTranslation->externalUrl = false; $this->db->persist($newPageTranslation); /** * Blog Page */ $newPage = new \Fraym\Menu\Entity\MenuItem(); $newPage->site = $site; $newPage->caching = true; $newPage->visible = true; $newPage->active = true; $newPage->https = false; $newPage->checkPermission = false; $newPage->is404 = false; $newPage->parent = $pageRoot; $newPageTranslation = new \Fraym\Menu\Entity\MenuItemTranslation(); $newPageTranslation->menuItem = $newPage; $newPageTranslation->title = $this->translation->autoTranslation('Blog', 'en', $gp->locale); $newPageTranslation->subtitle = $this->translation->autoTranslation('This is my blog.', 'en', $gp->locale); $newPageTranslation->url = "blog"; $newPageTranslation->shortDescription = $this->translation->autoTranslation('Check out my blog.', 'en', $gp->locale); $newPageTranslation->longDescription = $this->translation->autoTranslation('Check out my blog.', 'en', $gp->locale); $newPageTranslation->externalUrl = false; $this->db->persist($newPageTranslation); $this->db->flush(); $this->db->clear(); return $this; }