/** * @param null $action * * @return string */ protected function _getRedirectUrl($action = null) { if (!empty($action)) { // forward to that action page $_returnUrl = '/' . $this->id . '/' . $action; } else { // redirect to back from which you came if (null === ($_returnUrl = Pii::user()->getReturnUrl())) { // or take me home $_returnUrl = Pii::url($this->id . '/index'); } } return $_returnUrl; }