public function setRedirect($url, $msg = null, $type = null)
{
// If we're parsing a non-SEF URL decide whether to use JRoute or not
if (strpos($url, 'index.php') === 0) {
$isAdmin = $this->container->platform->isBackend();
$auto = false;
if (($this->autoRouting == 2 || $this->autoRouting == 3) && $isAdmin) {
$auto = true;
}
if (($this->autoRouting == 1 || $this->autoRouting == 3) && !$isAdmin) {
$auto = true;
}
if ($auto) {
$url = \JRoute::_($url, false);
}
}
// Set the redirection
$this->redirect = $url;
if ($msg !== null) {
// Controller may have set this directly
$this->message = $msg;
}
// Ensure the type is not overwritten by a previous call to setMessage.
if (empty($this->messageType)) {
$this->messageType = 'message';
}
// If the type is explicitly set, set it.
if (!empty($type)) {
$this->messageType = $type;
}
return $this;
}