@Template

@param Request $request

@return array|\Symfony\Component\HttpFoundation\RedirectResponse
337299
public function newAction(Request $request)
    {
        $page = new Page();

        $form = $this->createCreateForm($page);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $channel = $this->getSelectedChannel();

            $page->setChannel($channel);

            $dm = $this->getDocumentManager();

            $dm->persist($page);
            $dm->flush();

            $this->get('integrated_page.services.route_cache')->clear();

            $this->get('braincrafted_bootstrap.flash')->success('Page created');

            return $this->redirect($this->generateUrl('integrated_page_page_index', ['channel' => $channel->getId()]));
        }

        return [
            'form' => $form->createView(),
        ];
    }
577083
public function redirectWebspaceAction(Request $request)
    {
        @trigger_error(__METHOD__ . '() is deprecated since version 1.6 and will be removed in 2.0. Replaced by ExceptionListener::redirectPartialMatch.', E_USER_DEPRECATED);

        $url = $this->resolveRedirectUrl(
            $request->get('redirect'),
            $request->getUri(),
            $request->get('_sulu')->getAttribute('resourceLocatorPrefix')
        );

        return new RedirectResponse($url, 301, ['Cache-Control' => 'private']);
    }
1208032
public function rootRedirectAction(Request $request)
    {
        $uri = $request->getUri();
        // Special case, not correctly setup yet. Do so now.
        if (!$this->isInstalled()) {
            return new RedirectResponse($uri . 'install.html');
        }

        return new RedirectResponse($uri . 'index.html');
    }
1316398
public function cdeleteAction(Request $request)
    {
        $repository = $this->getRedirectRouteRepository();
        $manager = $this->getRedirectRouteManager();

        $ids = array_filter(explode(',', $request->query->get('ids', '')));
        foreach ($ids as $id) {
            $redirectRoute = $repository->find($id);
            if (!$redirectRoute) {
                continue;
            }

            $manager->delete($redirectRoute);
        }

        $this->get('doctrine.orm.entity_manager')->flush();

        return $this->handleView($this->view());
    }
889736
public function homepage(Request $request)
    {
        $homepage = $this->getOption('theme/homepage') ?: $this->getOption('general/homepage');
        $listingParameters = $this->getListingParameters($homepage, true);
        $content = $this->getContent($homepage, $listingParameters);

        $template = $this->templateChooser()->homepage($content);
        $globals = [];

        if (is_array($content) && count($content) > 0) {
            $first = current($content);
            $globals[$first->contenttype['slug']] = $content;
            $globals['records'] = $content;
        } elseif (is_object($content)) {
            $globals['record'] = $content;
            $globals[$content->contenttype['singular_slug']] = $content;
            $globals['records'] = [$content->id => $content];
        }

        return $this->render($template, [], $globals);
    }
1181851
public function indexAction(Request $request)
    {
        /** @var HttpErrorRepository $errorRepository */
        $errorRepository = $this->getDoctrine()->getManager()->getRepository('VictoireSeoBundle:HttpError');

        // Fetch errors

        $routes = $errorRepository->getRouteErrors();
        $routesResults = $routes->getQuery()->getResult();

        $files = $errorRepository->getFileErrors();
        $filesResults = $files->getQuery()->getResult();

        // Build forms

        $forms = [];
        $errors = array_merge($routesResults, $filesResults);

        /** @var Error404 $error */
        foreach ($errors as $error) {
            $redirection = new ErrorRedirection();
            $redirection->setError($error);
            $forms[$error->getId()] = $this->getError404RedirectionForm($redirection)->createView();
        }

        // Return datas

        return new Response($this->renderView('@VictoireSeo/Error404/index.html.twig', [
            'routes' => $routesResults,
            'files'  => $filesResults,
            'forms'  => $forms,
        ]));
    }
556327
protected function getFiltersFromRequest(Request $request)
    {
        return $this->extractValues($this->getValuesFromRequest($request), $this->getFilterPrefix());
    }
1340999
public function indexAction(Request $request)
    {
        // Special case, not correctly setup yet. Do so now.
        if (!$this->isInstalled()) {
            return new RedirectResponse($request->getUri() . 'install.html');
        }

        return new Response(
            str_replace(
                'var TENSIDEApi=window.location.href.split(\'#\')[0];',
                'var TENSIDEApi=\'' . $request->getSchemeAndHttpHost() . $request->getBaseUrl() . '/\';',
                file_get_contents($this->getAssetsDir() . '/index.html')
            ),
            200,
            [
                'Content-Type' => 'text/html; charset=UTF-8'
            ]
        );
    }
1241862
protected function getRedirectionUrl(Request $request)
    {
        $locale = $request->segment(1, null);

        if ($this->getSupportedLocales()->has($locale))
            return $this->isDefaultLocaleHidden($locale)
                ? $this->localization->getNonLocalizedURL()
                : false;

        // If the current url does not contain any locale
        // The system redirect the user to the very same url "localized" we use the current locale to redirect him
        if (
            $this->getCurrentLocale() !== $this->getDefaultLocale() ||
            ! $this->hideDefaultLocaleInURL()
        ) {
            return $this->localization->getLocalizedURL(session('locale'), $request->fullUrl());
        }

        return false;
    }
1094622
public function fieldsAction(Request $request)
    {
        return $this->handleView(
            $this->view(
                array_values(
                    array_diff_key(
                        $this->getManager()->getFieldDescriptors($this->getLocale($request)),
                        [
                            'statusId' => false,
                            'categoryIds' => false,
                        ]
                    )
                ),
                200
            )
        );
    }
43985
protected function redirectTo($request)
    {
        session()->put('loginRedir', $_SERVER["REQUEST_URI"]);
        session()->put('loginRedirTime', time());
        if (!$request->expectsJson()) {
            return route('login');
        }
    }
1020300
public function resolve(Request $request)
    {
        $attributes = $this->urlMatcher->match($request->getPathInfo());
        $controllerNotation = explode('@', $attributes['_route']);
        unset($attributes['_route']);

        $controller = explode(':', $controllerNotation[0]);

        $total = count($controller);
        $last = $total - 1;

        $controller[$total] = sprintf('%sController', $controller[$last]);
        $controller[$last] = 'Controller';

        $action = sprintf('%sAction', $controllerNotation[1]);
        unset($controllerNotation);

        $class = implode('\\', $controller);
        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('Class "%s" is not exist.', $class));
        }

        $implements = class_implements($class);
        if (!array_key_exists(ControllerInterface::class, $implements)) {
            throw new \InvalidArgumentException(sprintf('"%s" must implement "%s"', $class, ControllerInterface::class));
        }

        return array(
            '_controller' => $class,
            '_action' => $action,
            '_parameters' => $attributes,
        );
    }
213072
public function getAction(Request $request)
    {
        $structureProvider = $this->get('sulu.content.structure_manager');
        $type = $request->get('type', 'default');

        $templates = [];
        foreach ($structureProvider->getStructures('article') as $structure) {
            if ($this->getType($structure->getStructure()) !== $type) {
                continue;
            }

            $templates[] = [
                'internal' => $structure->getInternal(),
                'template' => $structure->getKey(),
                'title' => $structure->getLocalizedTitle($this->getUser()->getLocale()),
            ];
        }

        return new JsonResponse(
            [
                '_embedded' => $templates,
                'total' => count($templates),
            ]
        );
    }
1115865
public function newAction(Request $request)
    {
        $redirection = new Redirection();

        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');
        $form->handleRequest($request);

        if ($request->query->get('novalidate', false) === false) {
            if ($form->isValid()) {
                if ($redirection->getLink()->getLinkType() !== Link::TYPE_NONE) {
                    $em = $this->getDoctrine()->getManager();
                    $em->persist($redirection);
                    $em->flush();

                    $this->congrat($this->get('translator')->trans('victoire.redirection.create.success'));

                    return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                        'isOpened'  => true,
                        'form'      => $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView(),
                        'icTrigger' => [
                            'target' => '#redirections-list-container',
                            'url'    => $this->generateUrl('victoire_redirection_showListItem', [
                                'id' => $redirection->getId(),
                            ]),
                        ],
                    ]), 200, [
                        'X-Inject-Alertify' => true,
                    ]);
                } else {
                    // force form error when no link submitted
                    $form->addError(new FormError('This value should not be blank.'));
                }
            } else {
                $this->warn($this->get('translator')->trans('victoire.404.form.error.unvalid'));
            }

            return new Response($this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'     => $form->createView(),
                'isOpened' => true,
            ]), 200, [
                'X-Inject-Alertify' => true,
            ]);
        }

        // rebuild form to avoid wrong form error
        $form = $this->getRedirectionForm($redirection, '#new-redirection-form-container');

        return new JsonResponse([
            'html' => $this->renderView('@VictoireSeo/Redirection/_newForm.html.twig', [
                'form'      => $form->createView(),
                'isOpened'  => true,
            ]),
        ]);
    }
866743
public function createAction(Request $request)
    {
        $form = $this->getForm();

        if ('POST' == $request->getMethod()) {
            $form->handleRequest($request);
            if ($form->isValid()) {

                $this->getManager()->create($form->getData());
                $this->get('session')->getFlashBag()->add('success', 'Repository created successfully');

                return new RedirectResponse($this->generateUrl('snide_travinizer_dashboard'));
            } else {
                $this->get('session')->getFlashBag()->add('error', 'Some errors have been found');

            }
        }
        return array(
            'form' => $form->createView(),
            'errors' => $form->getErrors()
        );
    }
415791
public function moveDownAction(Request $request)
    {
        $context = $this->loadContext($request);

        $resource = $context->getResource();

        $this->isGranted('EDIT', $resource);

        $repo = $this->getRepository();
        $repo->moveDown($resource, 1);

        return $this->redirectToReferer($this->generateUrl(
            $this->config->getRoute('list'),
            $context->getIdentifiers()
        ));
    }
1074729
protected function getFilters(Request $request)
    {
        $type = $this->getFilterType($request);

        if (!$type) {
            return $request->query->get('search')['value'];
        }

        $filter = new $type();

        $param = $filter->getBlockPrefix();

        return $request->query->get($param);
    }