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

        /** @var ClipboardBlockService $clipboardService */
        $clipboardService  = $this->get('opifer.content.clipboard_block');
        $response = new JsonResponse;

        try {
            $block = $manager->find($id, true);
            $clipboardService->addToClipboard($block);
            $blockService = $manager->getService($block);

            $response->setData(['message' => sprintf('%s copied to clipboard', $blockService->getName())]);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
public function clipboardBlockAction($id)
    {
        /** @var BlockManager $manager */
        $manager  = $this->get('opifer.content.block_manager');

        /** @var ClipboardBlockService $clipboardService */
        $clipboardService  = $this->get('opifer.content.clipboard_block');
        $response = new JsonResponse;

        try {
            $block = $manager->find($id, true);
            $clipboardService->addToClipboard($block);
            $blockService = $manager->getService($block);

            $response->setData(['message' => sprintf('%s copied to clipboard', $blockService->getName())]);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
public function clipboardBlockAction ( $ id ) { /** @var BlockManager $manager */ $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; /** @var ClipboardBlockService $clipboardService */ $ clipboardService = $ this -> get ( 'opifer.content.clipboard_block' ) ; $ response = new JsonResponse ; try { $ block = $ manager -> find ( $ id , true ) ; $ clipboardService -> addToClipboard ( $ block ) ; $ blockService = $ manager -> getService ( $ block ) ; $ response -> setData ( [ 'message' => sprintf ( '%s copied to clipboard' , $ blockService -> getName ( ) ) ] ) ; } catch ( \ Exception $ e ) { $ response -> setStatusCode ( 500 ) ; $ response -> setData ( [ 'error' => $ e -> getMessage ( ) ] ) ; } return $ response ; }
Copies a reference of a block to the clipboard

@param integer $id

@return JsonResponse
Copies a reference of a block to the clipboard