/**
  * @param BlockInterface $block
  * @param boolean        $isInside
  *
  * @return FacadeInterface
  *
  * @throws TransformerParameterTypeException
  */
 public function transform($block, $isInside = true)
 {
     if (!$block instanceof BlockInterface) {
         throw new TransformerParameterTypeException();
     }
     $facade = $this->newFacade();
     $facade->method = $isInside ? BlockFacade::GENERATE : BlockFacade::LOAD;
     $facade->component = $block->getComponent();
     $facade->label = $block->getLabel();
     $facade->style = $block->getStyle();
     $facade->id = $block->getId();
     foreach ($block->getAttributes() as $key => $attribute) {
         if (is_array($attribute)) {
             $attribute = json_encode($attribute);
         }
         $facade->addAttribute($key, $attribute);
     }
     if (count($block->getAttributes()) > 0) {
         $html = $this->displayBlockManager->show($block)->getContent();
     } else {
         $html = $this->displayIconManager->show($block->getComponent());
     }
     $facade->uiModel = $this->getTransformer('ui_model')->transform(array('label' => $block->getLabel() ?: $this->translator->trans('open_orchestra_backoffice.block.' . $block->getComponent() . '.title'), 'html' => $html));
     $facade->addLink('_self_form', $this->generateRoute('open_orchestra_backoffice_block_new', array('component' => $block->getComponent())));
     $facade->isDeletable = true;
     if ($this->nodeRepository->isBlockUsed($block->getId())) {
         $facade->isDeletable = false;
     }
     return $facade;
 }