/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('permissions'); $menuItem->setLabel('Permissions'); $menuItem->setDescription('Manage what users are able to do.'); $menuItem->setRoute('zym_security_acl_entries'); $menuItem->setWeight(30); $this->addMenuItem('management', $menuItem, 'security'); $menuItem = new RoutedMenuItem('roles'); $menuItem->setLabel('Roles'); $menuItem->setDescription('Manage roles users can be assigned to.'); $menuItem->setRoute('zym_security_acl_roles'); $menuItem->setWeight(40); $this->addMenuItem('management', $menuItem, 'security'); $menuItem = new RoutedMenuItem('access-rules'); $menuItem->setLabel('Access Rules / Firewall'); $menuItem->setDescription('Manage access by the URL path.'); $menuItem->setRoute('zym_security_access_rules'); $menuItem->setWeight(60); $this->addMenuItem('management', $menuItem, 'security'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('parameters'); $menuItem->setLabel('Parameters'); $menuItem->setDescription('Manage the parameters.'); $menuItem->setRoute('zym_runtime_config_parameters'); $menuItem->setWeight(100); $this->addMenuItem('management', $menuItem, 'system'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('media'); $menuItem->setLabel('Media'); $menuItem->setDescription('Manage media assets.'); $menuItem->setRoute('zym_media'); $menuItem->setWeight(30); $this->addMenuItem('management', $menuItem); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('theme-rules'); $menuItem->setLabel('Theme Rules'); $menuItem->setDescription('Manage which themes should be displayed.'); $menuItem->setRoute('zym_theme_theme_rules'); $menuItem->setWeight(50); $this->addMenuItem('management', $menuItem, 'structure'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('routes'); $menuItem->setLabel('Routes'); $menuItem->setDescription('Manage what each URL shows.'); $menuItem->setRoute('zym_router_routes'); $menuItem->setWeight(90); $this->addMenuItem('management', $menuItem, 'system'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('content'); $menuItem->setLabel('Content'); $menuItem->setDescription('Manage content.'); $menuItem->setRoute('zym_nodes'); $menuItem->setWeight(20); $this->addMenuItem('management', $menuItem); $menuItem = new RoutedMenuItem('content-types'); $menuItem->setLabel('Content Types'); $menuItem->setDescription('Manage the available content types.'); $menuItem->setRoute('zym_node_node_types'); $menuItem->setWeight(10); $this->addMenuItem('management', $menuItem, 'structure'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $container = $this->container; if (!array_key_exists('ZymMenuBundle', $container->getParameter('kernel.bundles'))) { return; } $menuItem = new RoutedMenuItem('users'); $menuItem->setLabel('Users'); $menuItem->setDescription('Manage users.'); $menuItem->setRoute('zym_user_users'); $menuItem->setWeight(40); $this->addMenuItem('management', $menuItem); $menuItem = new RoutedMenuItem('groups'); $menuItem->setLabel('Groups'); $menuItem->setDescription('Manage groups.'); $menuItem->setRoute('zym_user_groups'); $menuItem->setWeight(10); $this->addMenuItem('management', $menuItem, 'users'); }
/** * Load * * @param ObjectManager $manager */ public function load(ObjectManager $manager) { $menuManager = $this->container->get('zym_menu.menu_manager'); $menuFactory = $this->container->get('knp_menu.factory'); $menuItemManager = $this->container->get('zym_menu.menu_item_manager'); // Main Menu $menu = new Entity\Menu(); $menu->setName('main'); $menu->setLabel('Main Menu'); $menu->setDescription('The Main menu\'s links drive the main navigation structure for your site, and are often displayed prominently across the top or side of the site.'); $menuManager->createMenu($menu); $menuItem = new Entity\MenuItem\StaticMenuItem('home', $menuFactory); $menuItem->setLabel('Home'); $menuItem->setUri('/'); $menu->addChild($menuItem); $menuItemManager->createMenuItem($menuItem); // Management Menu $menu = new Entity\Menu(); $menu->setName('management'); $menu->setLabel('Management Menu'); $menu->setDescription('The Management menu contains links for administrative tasks.'); $menuManager->createMenu($menu); $menuItem = new Entity\MenuItem\StaticMenuItem('home', $menuFactory); $menuItem->setLabel('Home'); $menuItem->setUri('/'); $menu->addChild($menuItem); $menuItemManager->createMenuItem($menuItem); $menuItem = new Entity\MenuItem\SectionMenuItem('reports', $menuFactory); $menuItem->setLabel('Reports'); $menuItem->setDescription('Manage the reporting application.'); $menuItem->setWeight(80); $menuItem->setUri('admin/reports'); $menu->addChild($menuItem); $menuItemManager->createMenuItem($menuItem); $menuItem = new Entity\MenuItem\SectionMenuItem('structure', $menuFactory); $menuItem->setLabel('Structure'); $menuItem->setDescription('Manage the structure for application.'); $menuItem->setWeight(100); $menuItem->setUri('admin/structure'); $menu->addChild($menuItem); $menuItemManager->createMenuItem($menuItem); $cMenuItem = new Entity\MenuItem\RoutedMenuItem('menus', $menuFactory); $cMenuItem->setLabel('Menus'); $cMenuItem->setDescription('Manage the structure of menus.'); $cMenuItem->setRoute('zym_menus'); $cMenuItem->setWeight(30); $menuItem->addChild($cMenuItem); $menuItemManager->createMenuItem($cMenuItem); $menuItem = new Entity\MenuItem\SectionMenuItem('configuration', $menuFactory); $menuItem->setLabel('Configuration'); $menuItem->setDescription('Manage the configuration for the application.'); $menuItem->setWeight(500); $menuItem->setUri('admin/config'); $menu->addChild($menuItem); $menuItemManager->createMenuItem($menuItem); $cMenuItem = new Entity\MenuItem\StaticMenuItem('security', $menuFactory); $cMenuItem->setLabel('Security'); $cMenuItem->setDescription('Manage the security for the application.'); $cMenuItem->setUri('/'); $cMenuItem->setWeight(70); $menuItem->addChild($cMenuItem); $menuItemManager->createMenuItem($cMenuItem); $cMenuItem = new Entity\MenuItem\StaticMenuItem('system', $menuFactory); $cMenuItem->setLabel('System'); $cMenuItem->setDescription('Manage the system settings for the application.'); $cMenuItem->setUri('/'); $cMenuItem->setWeight(80); $menuItem->addChild($cMenuItem); $menuItemManager->createMenuItem($cMenuItem); $menuManager->saveMenu($menu); $manager->flush(); }
/** * Add a menu item * * @param Entity\Menu $menu * * @Route( * "/{id}/add/{type}", * name = "zym_menus_item_add", * defaults = { * "type" = null * } * ) * @ParamConverter("menu", class="ZymMenuBundle:Menu") * @Template() * * @SecureParam(name="menu", permissions="EDIT") */ public function addMenuItemAction(Entity\Menu $menu, $type = null) { $securityContext = $this->get('security.context'); // check for create access if (!$securityContext->isGranted('CREATE', new ObjectIdentity('class', 'Zym\\Bundle\\MenuBundle\\Entity\\MenuItem'))) { throw new \Symfony\Component\Security\Core\Exception\AccessDeniedException(); } if ($type) { switch ($type) { case 'routed': $menuItem = new Entity\MenuItem\RoutedMenuItem(null, $this->get('knp_menu.factory'), $menu); $menuItem->setRouter($this->get('router')); $form = $this->createForm(new Form\MenuItem\RoutedMenuItemType(), $menuItem); break; case 'static': $menuItem = new Entity\MenuItem\StaticMenuItem(null, $this->get('knp_menu.factory'), $menu); $form = $this->createForm(new Form\MenuItem\StaticMenuItemType(), $menuItem); break; case 'section': $menuItem = new Entity\MenuItem\SectionMenuItem(null, $this->get('knp_menu.factory'), $menu); $form = $this->createForm(new Form\MenuItem\SectionMenuItemType(), $menuItem); break; default: throw $this->createNotFoundException('Invalid MenuItem Type'); } $request = $this->get('request'); if ($request->getMethod() == 'POST') { $form->bind($request); if ($form->isValid()) { $menuItemManager = $this->get('zym_menu.menu_item_manager'); $menuItemManager->createMenuItem($menuItem); return $this->redirect($this->generateUrl('zym_menus_show', array('id' => $menu->getName()))); } } return array('menu' => $menu, 'form' => $form->createView(), 'type' => $type); } }