diff --git a/components/com_content/controllers/article.php b/components/com_content/controllers/article.php index ec77b718b455b..760c35f855236 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -55,7 +55,19 @@ public function add() { // Redirect to the return page. $this->setRedirect($this->getReturnPage()); + + return; } + + // Redirect to the edit screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&a_id=0' + . $this->getRedirectToItemAppend(), false + ) + ); + + return true; } /** diff --git a/components/com_content/router.php b/components/com_content/router.php index 13fc7df39e5f3..5ea289404d537 100644 --- a/components/com_content/router.php +++ b/components/com_content/router.php @@ -39,7 +39,9 @@ public function __construct($app = null, $menu = null) $this->registerView($article); $this->registerView(new JComponentRouterViewconfiguration('archive')); $this->registerView(new JComponentRouterViewconfiguration('featured')); - $this->registerView(new JComponentRouterViewconfiguration('form')); + $form = new JComponentRouterViewconfiguration('form'); + $form->setKey('a_id'); + $this->registerView($form); parent::__construct($app, $menu); @@ -133,6 +135,19 @@ public function getArticleSegment($id, $query) return array((int) $id => $id); } + /** + * Method to get the segment(s) for an form + * + * @param string $id ID of the article form to retrieve the segments for + * @param array $query The request that is built right now + * + * @return array|string The segments of this item + */ + public function getFormSegment($id, $query) + { + return $this->getArticleSegment($id, $query); + } + /** * Method to get the id for a category * diff --git a/libraries/cms/component/router/rules/menu.php b/libraries/cms/component/router/rules/menu.php index 125754c028f37..30aa54865664e 100644 --- a/libraries/cms/component/router/rules/menu.php +++ b/libraries/cms/component/router/rules/menu.php @@ -188,13 +188,18 @@ protected function buildLookup($language = '*') $this->lookup[$language][$view] = array(); } + // If menuitem has no key set, we assume 0. + if (!isset($item->query[$views[$view]->key])) + { + $item->query[$views[$view]->key] = 0; + } + /** * Here it will become a bit tricky * language != * can override existing entries * language == * cannot override existing entries */ - if (isset($item->query[$views[$view]->key]) - && (!isset($this->lookup[$language][$view . $layout][$item->query[$views[$view]->key]]) || $item->language !== '*')) + if (!isset($this->lookup[$language][$view . $layout][$item->query[$views[$view]->key]]) || $item->language !== '*') { $this->lookup[$language][$view . $layout][$item->query[$views[$view]->key]] = $item->id; $this->lookup[$language][$view][$item->query[$views[$view]->key]] = $item->id;