public function createBlockAction(Request $request)
    {
        $row = $this->findRowByRequest($request);
        $type = $request->request->get('type', null);

        try {
            $block = $this->getEditor()->createDefaultBlock($type, [], $row);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

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

        $viewBuilder = $this->getViewBuilder();

        $data = [
            'created' => $viewBuilder->buildBlock($block)->getAttributes()->getId(),
            'rows'    => [$viewBuilder->buildRow($row)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
public function createBlockAction(Request $request)
    {
        $row = $this->findRowByRequest($request);
        $type = $request->request->get('type', null);

        try {
            $block = $this->getEditor()->createDefaultBlock($type, [], $row);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

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

        $viewBuilder = $this->getViewBuilder();

        $data = [
            'created' => $viewBuilder->buildBlock($block)->getAttributes()->getId(),
            'rows'    => [$viewBuilder->buildRow($row)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
public function createBlockAction ( Request $ request ) { $ row = $ this -> findRowByRequest ( $ request ) ; $ type = $ request -> request -> get ( 'type' , null ) ; try { $ block = $ this -> getEditor ( ) -> createDefaultBlock ( $ type , [ ] , $ row ) ; } catch ( EditorExceptionInterface $ e ) { return $ this -> handleException ( $ e ) ; } $ this -> validate ( $ row ) ; $ this -> persist ( $ row ) ; $ viewBuilder = $ this -> getViewBuilder ( ) ; $ data = [ 'created' => $ viewBuilder -> buildBlock ( $ block ) -> getAttributes ( ) -> getId ( ) , 'rows' => [ $ viewBuilder -> buildRow ( $ row ) ] , ] ; return $ this -> buildResponse ( $ data , self :: SERIALIZE_FULL ) ; }
Create and append a new block to the row.

@param Request $request

@return \Symfony\Component\HttpFoundation\Response
Create and append a new block to the row .