Move the resource one place down.

@param  Request $request
@return array $pageblock
167230
public function moveDown(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $pageblock = $this->pageBlockRepository->moveDownById($request->get('pageblock_id'));
        return $pageblock;
    }
1058787
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeBookmark(
            new BookmarkRemoveData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (BookmarkRemoveData $data) {
                foreach ($data->getBookmarks() as $locationId => $selected) {
                    $this->bookmarkService->deleteBookmark(
                        $this->locationService->loadLocation($locationId)
                    );
                }

                return $this->redirectToRoute('ezplatform.bookmark.list');
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirectToRoute('ezplatform.bookmark.list');
    }
601770
public function savePositionAction(Request $request = null)
    {
        $this->admin->checkAccess('savePosition');

        try {
            $params = $request->get('disposition');

            if (!\is_array($params)) {
                throw new HttpException(400, 'wrong parameters');
            }

            $result = $this->get('sonata.page.block_interactor')->saveBlocksPosition($params, false);

            $status = 200;

            $pageAdmin = $this->get('sonata.page.admin.page');
            $pageAdmin->setRequest($request);
            $pageAdmin->update($pageAdmin->getSubject());
        } catch (HttpException $e) {
            $status = $e->getStatusCode();
            $result = [
                'exception' => \get_class($e),
                'message' => $e->getMessage(),
                'code' => $e->getCode(),
            ];
        } catch (\Exception $e) {
            $status = 500;
            $result = [
                'exception' => \get_class($e),
                'message' => $e->getMessage(),
                'code' => $e->getCode(),
            ];
        }

        $result = (true === $result) ? 'ok' : $result;

        return $this->renderJson(['result' => $result], $status);
    }
718241
public function index(Request $request)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin']);

        // Get all pagetypes
        $pagetypes = PageType::orderBy('updated_at', 'desc')
            ->orderBy('created_at', 'desc')
            ->paginate(self::PAGINATION_ITEMS);

        return view('page::pagetypes.index', ['pagetypes' => $pagetypes]);
    }
500418
public function fromRequest(Request $request)
    {
        $pageName = $request->get('page');
        $language = $request->get('_locale');
        $permalink = $request->get('permalink');
        $options = array(
            "pageName" => $pageName,
            "languageName" => $language,
            "permalink" => $permalink,
            "pageId" => (int) $request->get('pageId'),
            "languageId" => (int) $request->get('languageId'),
        );

        $this->fromOptions($options);
    }
1163348
public function store(Request $request)
    {
        $this->validate($request, [
            'title' => 'required|max:255',
            'type'  => 'required|max:255|alpha|unique:navigation,type',
        ]);

        $navigation = new Navigation;
        $navigation->fill($request->all());
        $navigation->published = $request->get('published', false);
        $navigation->save();
        flash()->success(trans('cms::navigation.store.success'));

        return redirect()->route('administrator.navigation.index');
    }
495402
public function renderAction(Request $request)
    {

        //TODO: render initial block via ajax
        $blockType = $request->get('blockType', null);
        $action    = $request->get('action', null);

        // merge all parameters
        $params = array_merge($request->request->all(), $request->query->all());

        // load block service
        $block = $this->getBlockServiceManager()->getService($blockType);
        if (!$block) {
            throw $this->createNotFoundException(sprintf('Cannot find block service "%s"', $blockType));
        }

        if(!$block instanceof AbstractAdminBlockService) {
            throw new \Exception('Block should be an instance of AbstractAdminBlockService');
        }

        $params['block'] = $block;

        $methodName = sprintf("%sAction", $action);

        if (!is_callable(array($block, $methodName), false)) {
            throw $this->createNotFoundException(sprintf('Cannot find method "%s" in block service "%s"', $methodName, $blockType));
        }

        return call_user_func_array(array($block, $methodName), array($request, $params));
    }
1143822
public function resourceByRequest(Request $request)
    {

        $routeName = $this->getRouteName($request);

        if (isset($this->routeMap[$routeName])) {
            return $this->routeMap[$routeName];
        }

        $this->routeMap[$routeName] = $this->calculateResourceName($routeName);

        return $this->routeMap[$routeName];

    }
465664
public function downAction(Request $request)
    {
        /** @var MenuRepository $repo */
        $repo = $this->get('vince_cms.repository.menu');
        /** @var Menu $menu */
        $menu = $repo->find($request->get('id'));
        if ($menu->getParent()) {
            $repo->moveDown($menu);
        }

        return $this->redirect($this->generateUrl('admin_my_cms_menu_list'));
    }
213393
public function findByRequest(Request $request): ?PageInterface
    {
        if (null !== $route = $request->attributes->get('_route', null)) {
            return $this->findByRoute($route);
        }

        return null;
    }
373693
private function move(Request $request, $direction)
    {
        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);

        $this->isGrantedOr403($configuration, ResourceActions::UPDATE);
        $resource = $this->findOr404($configuration);

        $this->repository->$direction($resource);

        /** @var ResourceControllerEvent $event */
        $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource);

        if ($event->isStopped() && !$configuration->isHtmlRequest()) {
            throw new HttpException($event->getErrorCode(), $event->getMessage());
        }
        if ($event->isStopped()) {
            $this->flashHelper->addFlashFromEvent($configuration, $event);

            if ($event->hasResponse()) {
                return $event->getResponse();
            }

            return $this->redirectHandler->redirectToResource($configuration, $resource);
        }

        try {
            $this->resourceUpdateHandler->handle($resource, $configuration, $this->manager);
        } catch (UpdateHandlingException $exception) {
            if (!$configuration->isHtmlRequest()) {
                return $this->viewHandler->handle(
                    $configuration,
                    View::create(null, $exception->getApiResponseCode())
                );
            }

            $this->flashHelper->addErrorFlash($configuration, $exception->getFlash());

            return $this->redirectHandler->redirectToReferer($configuration);
        }

        $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::UPDATE, $configuration, $resource);

        if (!$configuration->isHtmlRequest()) {
            $view = $configuration->getParameters()->get('return_content', false) ? View::create(
                $resource,
                Response::HTTP_OK
            ) : View::create(null, Response::HTTP_NO_CONTENT);

            return $this->viewHandler->handle($configuration, $view);
        }

        $this->flashHelper->addSuccessFlash($configuration, ResourceActions::UPDATE, $resource);

        if ($postEvent->hasResponse()) {
            return $postEvent->getResponse();
        }

        return $this->redirectHandler->redirectToResource($configuration, $resource);
    }
775805
public function discardBlockAction(Request $request)
    {
        $this->getDoctrine()->getManager()->getFilters()->disable('draft');

        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        $response = new JsonResponse;
        $id = (int) $request->request->get('id');

        try {
            $manager->discardAll($id);

            $response->setStatusCode(200);
            $response->setData(['state' => 'discarded']);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
1271289
public function bindRequest(Request $request)
    {
        $query = $request->query;
        $session = $request->getSession();

        $adminListName = 'listconfig_'.$request->get('_route');

        $this->page = $request->query->getInt('page', 1);
        // Allow alphanumeric, _ & . in order by parameter!
        $this->orderBy = preg_replace('/[^[a-zA-Z0-9\_\.]]/', '', $request->query->get('orderBy', ''));
        $this->orderDirection = $request->query->getAlpha('orderDirection', '');

        // there is a session and the filter param is not set
        if ($session->has($adminListName) && !$query->has('filter')) {
            $adminListSessionData = $request->getSession()->get($adminListName);
            if (!$query->has('page')) {
                $this->page = $adminListSessionData['page'];
            }

            if (!$query->has('orderBy')) {
                $this->orderBy = $adminListSessionData['orderBy'];
            }

            if (!$query->has('orderDirection')) {
                $this->orderDirection = $adminListSessionData['orderDirection'];
            }
        }

        // save current parameters
        $session->set(
            $adminListName,
            array(
                'page' => $this->page,
                'orderBy' => $this->orderBy,
                'orderDirection' => $this->orderDirection,
            )
        );

        $this->getFilterBuilder()->bindRequest($request);
    }
1307970
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeLocation(
            new ContentLocationRemoveData()
        );
        $form->handleRequest($request);

        /** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentLocationRemoveData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getLocations() as $locationId => $selected) {
                    $location = $this->locationService->loadLocation($locationId);
                    $this->locationService->deleteLocation($location);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Location '%name%' removed.") */
                            'location.delete.success',
                            ['%name%' => $location->getContentInfo()->name],
                            'location'
                        )
                    );
                }

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => LocationsTab::URI_FRAGMENT,
                ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => LocationsTab::URI_FRAGMENT,
        ]));
    }
532345
public function trashed(Request $request)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin', 'editor']);

        $pages = Page::onlyTrashed()
            ->orderBy('updated_at', 'desc')
            ->orderBy('created_at', 'desc')
            ->with('pagetype')
            ->paginate(self::PAGINATION_ITEMS);

        return view('page::pages.trashed', ['pages' => $pages]);
    }
267631
protected function getSortingFromRequest(Request $request)
    {
        return $this->extractValues($this->getValuesFromRequest($request), $this->getSortingPrefix());
    }
596062
final public function prepare(PageRequest $request)
	{
		$this->request = $request;
		$this->response = $this->createBlockResponse($request);
		
		$this->properties = $request->getBlockPropertySet()
				->getBlockPropertySet($this->block);

		try {
			$this->doPrepare();
		} catch (\Exception $e) {
			$this->exception = $e;
		}
	}