/** * @return array|\Symfony\Component\HttpFoundation\RedirectResponse */ public function execute() { if ($this->request->getPost()->count() !== 0) { return $this->executePost($this->request->getPost()->all()); } if ($this->articlesHelpers) { $this->view->assign('articles', $this->articlesHelpers->articlesList()); } $defaults = ['title' => '', 'uri' => '']; $this->view->assign($this->menuItemFormFieldsHelper->createMenuItemFormFields()); return ['mode' => $this->fetchMenuItemTypes(), 'modules' => $this->fetchModules(), 'target' => $this->formsHelper->linkTargetChoicesGenerator('target'), 'form' => array_merge($defaults, $this->request->getPost()->all()), 'form_token' => $this->formTokenHelper->renderFormToken()]; }
/** * @param array $menuItem * @return array */ protected function addFormFields(array $menuItem) { if (!empty($menuItem)) { return $this->menuItemFormFields->createMenuItemFormFields($menuItem['block_id'], $menuItem['parent_id'], $menuItem['left_id'], $menuItem['right_id'], $menuItem['display']); } return $this->menuItemFormFields->createMenuItemFormFields(); }
/** * @param int $id * * @return array|\Symfony\Component\HttpFoundation\RedirectResponse * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id) { $menuItem = $this->menuItemsModel->getOneById($id); if (empty($menuItem) === false) { $this->title->setPageTitlePostfix($menuItem['title']); if ($this->request->getPost()->count() !== 0) { return $this->executePost($this->request->getPost()->all(), $menuItem, $id); } if ($this->articlesHelpers) { $matches = []; if (count($this->request->getPost()->all()) == 0 && $menuItem['mode'] == 4) { preg_match_all(Menus\Helpers\MenuItemsList::ARTICLES_URL_KEY_REGEX, $menuItem['uri'], $matches); } $this->view->assign('articles', $this->articlesHelpers->articlesList(!empty($matches[2]) ? $matches[2][0] : '')); } $this->view->assign($this->menuItemFormFieldsHelper->createMenuItemFormFields($menuItem['block_id'], $menuItem['parent_id'], $menuItem['left_id'], $menuItem['right_id'], $menuItem['display'])); return ['mode' => $this->fetchMenuItemTypes($menuItem['mode']), 'modules' => $this->fetchModules($menuItem), 'target' => $this->formsHelper->linkTargetChoicesGenerator('target', $menuItem['target']), 'form' => array_merge($menuItem, $this->request->getPost()->all()), 'form_token' => $this->formTokenHelper->renderFormToken()]; } throw new Core\Controller\Exception\ResultNotExistsException(); }