/** * Redirect to an other URLs * * @param string $path * @param int $statusCode * * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse */ protected function createRedirectResponse($path, $statusCode) { $path = $this->router->route($path, true); if ($this->request->isXmlHttpRequest() === true) { return $this->createAjaxRedirectResponse($path); } return new SymfonyRedirectResponse($path, $statusCode); }
/** * @param \Exception $exception * @return array|JsonResponse */ public function renderErrorBoxOnFailedFormValidation(\Exception $exception) { $errors = $this->alerts->errorBox($exception->getMessage()); if ($this->request->isXmlHttpRequest()) { return new JsonResponse(['success' => false, 'content' => $errors]); } return ['error_msg' => $errors]; }
/** * @return string */ protected function addElementFromMinifier() { $minifyJs = ''; if (!$this->request->isXmlHttpRequest()) { $minifyJs = '<script type="text/javascript" src="' . $this->minifier->getURI() . '"></script>' . "\n"; } return $minifyJs; }
/** * @inheritdoc */ protected function addCustomTemplateVarsBeforeOutput() { $this->view->assign('PAGE_TITLE', $this->translator->t('install', 'acp3_installation')); $this->view->assign('TITLE', $this->translator->t($this->request->getModule(), $this->request->getController() . '_' . $this->request->getAction())); $this->view->assign('LAYOUT', $this->request->isXmlHttpRequest() ? 'layout.ajax.tpl' : $this->getLayout()); }
/** * Returns the pretty printed form errors * * @param string|array $errors * @return string */ public function errorBox($errors) { $this->view->assign('CONTENT_ONLY', $this->request->isXmlHttpRequest() === true); return $this->view->fetchTemplate($this->errorBoxContent($errors)); }