Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 22 additions & 28 deletions libraries/src/MVC/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ public function delete()
$this->postDeleteHook($model, $cid);
}

$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. $this->getRedirectToListAppend(),
false
)
);
$this->setRedirect($this->getRedirectUrlToList());
}

/**
Expand Down Expand Up @@ -241,13 +235,7 @@ public function publish()
}
}

$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. $this->getRedirectToListAppend(),
false
)
);
$this->setRedirect($this->getRedirectUrlToList());
}

/**
Expand All @@ -271,7 +259,7 @@ public function reorder()
$model = $this->getModel();
$return = $model->reorder($ids, $inc);

$redirect = Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false);
$redirect = $this->getRedirectUrlToList();

if ($return === false) {
// Reorder failed.
Expand Down Expand Up @@ -317,7 +305,7 @@ public function saveorder()
// Save the ordering
$return = $model->saveorder($pks, $order);

$redirect = Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false);
$redirect = $this->getRedirectUrlToList();

if ($return === false) {
// Reorder failed
Expand Down Expand Up @@ -358,10 +346,7 @@ public function checkin()
// Checkin failed.
$message = Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError());
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(),
false
),
$this->getRedirectUrlToList(),
$message,
'error'
);
Expand All @@ -371,13 +356,7 @@ public function checkin()

// Checkin succeeded.
$message = Text::plural($this->text_prefix . '_N_ITEMS_CHECKED_IN', \count($ids));
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(),
false
),
$message
);
$this->setRedirect($this->getRedirectUrlToList(), $message);

return true;
}
Expand Down Expand Up @@ -452,7 +431,7 @@ public function runTransition()

$return = $model->executeTransition($pks, $transitionId);

$redirect = Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false);
$redirect = $this->getRedirectUrlToList();

if ($return === false) {
// Transition change failed.
Expand All @@ -469,6 +448,21 @@ public function runTransition()
return true;
}

/**
* Gets the URL to redirect to the list view.
*
* @return string The redirect URL.
*
* @since __DEPLOY_VERSION__
*/
protected function getRedirectUrlToList(): string
{
return Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(),
false
);
}

/**
* Gets the URL arguments to append to a list redirect.
*
Expand Down
Loading