Skip to content

Commit

Permalink
[com_fields] Fix front end articles category switch (#17872)
Browse files Browse the repository at this point in the history
* Fix front end articles category switch

* Check if it is allowed to add an article
  • Loading branch information
laoneo authored and Michael Babker committed Sep 7, 2017
1 parent 333d326 commit a072516
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 16 additions & 1 deletion components/com_content/controllers/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function cancel($key = 'a_id')
$cancelMenuitemId = (int) $params->get('cancel_redirect_menuitem');

if ($cancelMenuitemId > 0)
{
{
$item = $app->getMenu()->getItem($cancelMenuitemId);
$lang = '';

Expand Down Expand Up @@ -389,6 +389,21 @@ public function save($key = null, $urlVar = 'a_id')
return $result;
}

/**
* Method to reload a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function reload($key = null, $urlVar = 'a_id')
{
return parent::reload($key, $urlVar);
}

/**
* Method to save a vote.
*
Expand Down
9 changes: 5 additions & 4 deletions libraries/src/MVC/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,11 @@ public function reload($key = null, $urlVar = null)

$recordId = $this->input->getInt($urlVar);

if (!$this->allowEdit($data, $key))
// Populate the row id from the session.
$data[$key] = $recordId;

// Check if it is allowed to edit or create the data
if (($recordId && !$this->allowEdit($data, $key)) || (!$recordId && !$this->allowAdd($data)))
{
$this->setRedirect(
\JRoute::_(
Expand All @@ -884,9 +888,6 @@ public function reload($key = null, $urlVar = null)
$this->redirect();
}

// Populate the row id from the session.
$data[$key] = $recordId;

// The redirect url
$redirectUrl = \JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item .
Expand Down

0 comments on commit a072516

Please sign in to comment.