Show block for editing.

@param Request $request
@param Model   $block

@return Response
481597
public function edit(BlockRequest $request, Block $block)
    {
        return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('block::block.name'))
            ->view('block::admin.block.edit')
            ->data(compact('block'))
            ->output();
    }
77903
public function editAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $site = $em->getRepository(Site::class)->find($id);

        $originalDomains = new ArrayCollection();
        foreach ($site->getDomains() as $domain) {
            $originalDomains->add($domain);
        }

        $form = $this->createForm(SiteType::class, $site);
        $form->handleRequest($request);


        if ($form->isSubmitted() && $form->isValid()) {

            // Remove deleted domains
            foreach ($originalDomains as $domain) {
                if (false === $site->getDomains()->contains($domain)) {
                    $em->remove($domain);
                }
            }

            // Add new domain
            foreach ($form->getData()->getDomains() as $domain) {
                $domain->setSite($site);
            }
            $em->persist($domain);

            $em->flush();

            return $this->redirectToRoute('opifer_cms_site_edit', ['id' => $site->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Site:edit.html.twig', [
            'form' => $form->createView(),
            'site' => $site,
        ]);
    }
62132
public function createBlockAction(Request $request, $type)
    {
        $entity = new Block();
        $entity->setType($type);
        $form = $this->createBlockCreateForm($entity);
        $form->handleRequest($request);

        $availableLangs = $this->container->getParameter('flowcode_page.available_languages');

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $page = $entity->getPage();
            foreach ($availableLangs as $key => $value) {
                $entityLang = new Block();
                $entityLang->setName($entity->getName());
                $entityLang->setLang($key);
                $entityLang->setContent($entity->getContent());
                $entityLang->setPage($entity->getPage());
                $entityLang->setType($type);
                $em->persist($entityLang);
            }


            $em->flush();

            return $this->redirect($this->generateUrl('admin_page_show', array('id' => $page->getId())));
        }

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
1145466
public function viewBlock(Block $block, array $params = array(), array $cacheSettings = array())
    {
        $response = new Response();
        if ($this->getParameter('content.view_cache') === true) {
            $response->setPublic();
            if (
                isset($cacheSettings['smax-age'])
                && is_int($cacheSettings['smax-age'])
            ) {
                $response->setSharedMaxAge((int)$cacheSettings['smax-age']);
            }
            if (
                isset($cacheSettings['max-age'])
                && is_int($cacheSettings['max-age'])
            ) {
                $response->setMaxAge((int)$cacheSettings['max-age']);
            }
        }

        $response->setContent(
            $this->viewManager->renderBlock(
                $block,
                $params + array(
                    // @deprecated pageService injection will be removed in 6.0.
                    'pageService' => $this->pageService,
                    'valid_items' => $this->pageService->getValidBlockItems($block),
                )
            )
        );

        return $response;
    }
1104519
public function getPageBlocksByRequest(Request $request)
    {
        $routeName = $request->get('_route');
        $pageName = $this->routeConfig->getPageName($routeName);

        if (!isset($this->pageBlocks[$pageName])) {
            throw new \Exception(
                sprintf(
                    'Not found blocs for page with name \'%s\' and route name \'%s\'',
                    $pageName,
                    $routeName
                )
            );
        }
        $blocks = $this->pageBlocks[$pageName];

        // add route_params to blocks
        foreach ($blocks as $index => $block) {
            $blocks[$index]['settings']['route_params'] = $request->get('_route_params');
        }

        return $blocks;
    }
18862
public function update(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $pageblock = $this->pageblock->getById($request->get('pageblock_id'));
        $pageblock = $this->pageBlockRepository->updateBody($pageblock, $request->get('html'));
        return $pageblock;
    }
899512
public function editorViewAction(Request $request, Template $template)
    {
        $request->request->set('blockMode', 'manage');
        return $this->render($template->getView(), ['block' => $template]);
    }
753044
public function execute(Request $request, $pageId, $blockId)
    {
        $cmsManager = $this->cmsManagerSelector->retrieve();

        $page = $cmsManager->getPageById($pageId);
        $block = $cmsManager->getBlock($blockId);

        if (!$block instanceof BlockInterface) {
            throw new BlockNotFoundException(sprintf('Unable to find block identifier "%s" in page "%s".', $blockId, $pageId));
        }

        $blockContext = $this->contextManager->get($block);

        return $this->blockRenderer->render($blockContext);
    }
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;
		}
	}
822070
public function index(BlockRequest $request)
    {

        if ($this->response->typeIs('json')) {
            $pageLimit = $request->input('pageLimit');
            $data      = $this->repository
                ->setPresenter(\Litecms\Block\Repositories\Presenter\BlockListPresenter::class)
                ->getDataTable($pageLimit);
            return $this->response
                ->data($data)
                ->output();
        }

        $blocks = $this->repository->paginate();

        return $this->response->setMetaTitle(trans('block::block.names'))
            ->view('block::admin.block.index')
            ->data(compact('blocks'))
            ->output();
    }
213335
public function edit(PageRequest $request, Page $page)
    {
        return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('page::page.name'))
            ->view('page::admin.page.edit')
            ->data(compact('page'))
            ->output();
    }
664279
public function moveBlockAction(Request $request)
    {
        $this->getDoctrine()->getManager()->getFilters()->disable('draftversion');

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

        $id          = (int) $request->request->get('id');
        $parentId    = (int) $request->request->get('parent');
        $sort        = $request->request->get('sort');
        $placeholder = (int) $request->request->get('placeholder');

        try {
            $manager->moveBlock($id, $parentId, $placeholder, $sort);

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

        return $response;
    }
160993
public function updateBlocks(ServerRequestInterface $request): ResponseInterface
    {
        $modules = $this->module_service->findByInterface(ModuleBlockInterface::class, true);

        $this->updateStatus($modules, $request);
        $this->updateAccessLevel($modules, ModuleBlockInterface::class, $request);

        return redirect(route('blocks'));
    }
692485
public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
    {
        $languages = (array) $request->get('lang');
        $this->setBlockSetting($block_id, 'title', $request->get('title', ''));
        $this->setBlockSetting($block_id, 'html', $request->get('html', ''));
        $this->setBlockSetting($block_id, 'show_timestamp', $request->get('show_timestamp', ''));
        $this->setBlockSetting($block_id, 'timestamp', (string) Carbon::now()->unix());
        $this->setBlockSetting($block_id, 'languages', implode(',', $languages));
    }
1303025
public function update(Model\BlockInterface $block, Request $request)
    {
        // Plugin update
        return $this->editor
            ->getBlockPlugin($block->getType())
            ->update($block, $request);
    }
681572
public function edit($request) {
        $controller=$this->getToplevelController();
        $form=$this->ItemEditForm($this->gridField, $request);
        
        
        return $controller->customise(array(
                                    'Title'=>($this->record && $this->record->ID ? $this->record->Title:sprintf(_t('GridField.NewRecord', 'New %s'), $this->record->i18n_singular_name())),
                                    'ItemEditForm'=>$form,
                                ))->renderWith($this->template);
    }
1254740
public function editAction(Request $request)
    {
        $form     = $this->validateRequestParameters($request);
        $resource = $this->mapper->getResource($request->get('id'));

        $this->mapper->populateResourceWithForm($resource, $form);
        $this->mapper->update($resource);

        // returns an empty 200 (OK)
        return new Response();
    }