Updates the container layout.

@param Request $request

@return Response
772344
public function layoutAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        $data = $request->request->get('data', []);

        try {
            $this->getEditor()->getLayoutAdapter()->updateContainerLayout($container, $data);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($container);
        $this->persist($container);

        $data = [
            'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
947600
public function moveAction(Request $request): Response
    {
        $form = $this->formFactory->moveLocation(
            new LocationMoveData()
        );
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationMoveData $data) {
                $location = $data->getLocation();
                $newParentLocation = $data->getNewParentLocation();

                if (!$newParentLocation->getContent()->getContentType()->isContainer) {
                    throw new InvalidArgumentException(
                        '$newParentLocation',
                        'Cannot move location to a parent that is not a container'
                    );
                }

                $this->locationService->moveSubtree($location, $newParentLocation);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("'%name%' moved to '%location%'") */
                        'location.move.success',
                        ['%name%' => $location->getContentInfo()->name, '%location%' => $newParentLocation->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $location->id,
                ]));
            });

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

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->id,
        ]));
    }
138566
public function updateTreeAction(Request $request)
    {
        /** @var Request $request */
        $nodes = $request->get('nodes') ? $request->get('nodes') : [];

        $admin = $this->get('networking_init_cms.admin.tag');

        $validator = $this->get('validator');
        try {
            foreach ($nodes as $node) {
                if (!$node['id']) {
                    continue;
                }
                /** @var $tag Tag */
                $tag = $admin->getObject($node['id']);
                if ($node['parent_id']) {
                    $parent = $admin->getObject($node['parent_id']);
                    $tag->setParent($parent);
                } else {
                    $tag->setParent(null);
                }

                $tag->setLevel($node['depth'] + 1);

                $errors = $validator->validate($tag);
                if (count($errors) > 0) {
                    throw new ValidatorException();
                }

                $this->admin->update($tag);
            }

            $response = ['status' => 'success', 'message' => $this->admin->trans('info.tag_sorted')];
        } catch (\Exception $e) {
            $response = ['status' => 'error', 'message' => $this->admin->trans('info.tag_sorted_error')];
        }

        return $this->renderJson($response);
    }
269793
public static function updateRequest($request) {
        $routeModel = Dir::apiModel(static::$model);
        $heroe = $routeModel::find($request->id);

        foreach($heroe->getTuples() as $tuple)
            if(!empty($request->$tuple))
                $heroe->$tuple = $request->$tuple;

        $heroe->update();
        return $heroe;
    }
1355954
public function editAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        try {
            $response = $this->getEditor()->getContainerManager()->update($container, $request);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        if ($response instanceof Modal) {
            return $this->renderModal($response);
        } elseif ($response instanceof Response) {
            return $response;
        }

        $this->validate($container);
        $this->persist($container);

        $data = [
            'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
276609
public function moveDownAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        try {
            $sibling = $this->getEditor()->getContainerManager()->moveDown($container);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $content = $container->getContent();

        $this->validate($content);
        $this->persist($content);

        $data = [
            'containers' => [
                $this->getViewBuilder()->buildContainer($container),
                $this->getViewBuilder()->buildContainer($sibling),
            ],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
1242464
public function indexAction(Request $request)
    {
        $layouts = $this->get('opifer.content.layout_manager')->getRepository()
            ->findAll();

        $data = $this->get('jms_serializer')->serialize($layouts, 'json');

        return new Response($data, 200, ['Content-Type' => 'application/json']);
    }
598508
public function removeItemAction(Request $request, Layout $layout)
    {
        $this->guard($layout, 'update');

        $region   = $this->validateInputAndGetRegionName($request);
        $position = $request->get('position', 0);
        $manager  = $this->getContextManager();
        $site     = $this->getSiteContext();
        $region   = $layout->getRegion($region);

        $region->removeAt($position);

        if ($manager->isPageContextRegion($region->getName(), $site->theme)) {
            $manager->getPageContext()->getStorage()->save($layout);
        } else if ($manager->isTransversalContextRegion($region->getName(), $site->theme)) {
            $manager->getSiteContext()->getStorage()->save($layout);
        } else {
            throw $this->createAccessDeniedException();
        }

        return new JsonResponse(['success' => true]);
    }
553
public function updateAction(Request $request, $id)
    {
        $this->checkCsrf();

        $transUnit = $this->get('lexik_translation.data_grid.request_handler')->updateFromRequest($id, $request);

        return $this->get('lexik_translation.data_grid.formatter')->createSingleResponse($transUnit);
    }
660574
public function updateMainTranslationAction(Request $request): Response
    {
        $form = $this->createForm(MainTranslationUpdateType::class, new MainTranslationUpdateData());
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (MainTranslationUpdateData $data) {
                $content = $data->getContent();
                $contentInfo = $content->contentInfo;
                $mapper = new MainTranslationUpdateMapper();
                $contentMetadataUpdateStruct = $mapper->reverseMap($data);
                $this->contentService->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct);
                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Main language for '%name%' updated.") */
                        'content.main_language_update.success',
                        ['%name%' => $contentInfo->name],
                        'content'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => 'ez-tab-location-view-translations',
                ]));
            });
            if ($result instanceof Response) {
                return $result;
            }
        }
        /** @var \EzSystems\EzPlatformAdminUi\Form\Data\Content\Translation\MainTranslationUpdateData $data */
        $data = $form->getData();
        $contentInfo = $data->getContentInfo();
        if (null !== $contentInfo) {
            return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                'locationId' => $contentInfo->mainLocationId,
                '_fragment' => 'ez-tab-location-view-translations',
            ]));
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
346550
public function moveAction(Request $request)
    {
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        if ($admin->isChild()) {
            $id = $request->query->get('childId');
        } else {
            $id = $request->query->get('id');
        }

        $targetId = $request->query->get('target');
        $dropPosition = $request->query->get('position');

        $em = $this->getDoctrine()->getManager();

        /** @var NestedTreeRepository $repo */
        $repo = $em->getRepository($admin->getClass());

        $currentNode = $repo->find($id);
        $targetNode = $repo->find($targetId);

        switch ($dropPosition) {
            case 'before':
                $currentNode->setParent($targetNode->getParent());

                if ($targetNode->getPosition()) {
                    $currentNode->setPosition($targetNode->getPosition() - 1);
                } else {
                    $currentNode->setPosition(0);
                }
                break;
            case 'after':
                $currentNode->setParent($targetNode->getParent());
                $currentNode->setPosition($targetNode->getPosition() + 1);
                break;
            case 'append':
                $currentNode->setParent($targetNode);
                $currentNode->setPosition(-1);
                break;
        }

        $admin->update($currentNode);
        $admin->update($targetNode);

        return $this->renderJson(['result' => true]);
    }
1121387
public function runController(Request $request)
    {
        /** @var $response Response */
        $response    = $this->container->get('\\Miny\\HTTP\\Response', [], true);
        $oldResponse = $this->container->setInstance($response);

        $response = $this->doRun($request, $response);

        if ($oldResponse) {
            return $this->container->setInstance($oldResponse);
        }

        return $response;
    }
1156278
public function addContentHere(Request $request)
    {
        $links = [];
        $handler = $this->getTypeHandler();
        foreach ($this->getTypeHandler()
                      ->getTypesAsHumanReadableList($handler->getContentTypes()) as $type => $name) {
            if (node_access('create', $type)) {
                $options = [
                    'query' => [
                        'destination' => $request->get('destination'),
                        'menu_name'   => $request->get('menu'),
                        'parent'      => $request->get('parent'),
                        'position'    => $request->get('position'),
                    ],
                ];
                $links[] = l($name, 'node/add/'.strtr($type, '_', '-'), $options);
            }
        }

        return [
            '#theme' => 'item_list',
            '#items' => $links,
        ];
    }
109632
public function createContainerAction(Request $request)
    {
        $content = $this->findContentByRequest($request);
        $type = $request->request->get('type', null);

        try {
            $container = $this->getEditor()->createDefaultContainer($type, [], $content);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($content);
        $this->persist($content);

        $viewBuilder = $this->getViewBuilder();

        $data = [
            'created' => $viewBuilder->buildContainer($container)->getAttributes()->getId(),
            'content' => $viewBuilder->buildContent($content),
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
210622
public function update(Model\ContainerInterface $container, Request $request)
    {
        // Plugin update
        return $this->editor
            ->getContainerPlugin($container->getType())
            ->update($container, $request);
    }
1072932
public function updateUserSettingsAction(Request $request)
    {
        /** @var array $settings */
        $settings = $request->get('settings');

        $user = $this->getUser();

        $userSettings = $user->getSettings();

        foreach ($settings as $settingKey => $value) {
            $userSettings[$settingKey] = $value;
        }

        $user->setSettings($userSettings);

        $em = $this->get('doctrine')->getManager();

        $em->persist($user);
        $em->flush();

        return new JsonResponse();
    }
484882
public function dispatch(Request $request)
    {
        $oldRequest = $this->container->setInstance($request);

        ob_start();
        $response = $this->filterRequest($request);
        $response->addContent(ob_get_clean());

        if ($oldRequest) {
            $this->container->setInstance($oldRequest);
        }

        return $response;
    }