public function buildBlock(Model\BlockInterface $block)
    {
        $editable = $this->editor->isEnabled();

        $view = new BlockView();
        $attributes = $view->getAttributes()->addClass('cms-block');

        if ($editable) {
            $row = $block->getRow();

            $attributes
                ->setId('cms-block-' . $block->getId())
                ->setData([
                    'id'       => $block->getId(),
                    'type'     => $block->getType(),
                    'position' => $block->getPosition(),
                    'actions'  => [
                        'add'         => !is_null($row),
                        'edit'        => false,
                        'layout'      => true,
                        'change_type' => !$block->isNamed(),
                        'move_left'   => !$block->isFirst(),
                        'move_right'  => !$block->isLast(),
                        'move_up'     => !$block->isAlone() && !$row->isFirst(),
                        'move_down'   => !$block->isAlone() && !$row->isLast(),
                        'remove'      => !$block->isAlone(),
                    ],
                ]);
        }

        $adapter = $this->editor->getLayoutAdapter();

        // Layout
        $adapter->buildBlock($block, $view);

        // Plugin
        $this->editor
            ->getBlockPlugin($block->getType())
            ->render($block, $view, $adapter, [
                'editable' => $editable,
            ]);

        // Set widgets positions
        /*$p = 0;
        foreach ($view->widgets as $widgetView) {
            $widgetView->getAttributes()->setData('position', $p);
            $p++;
        }*/

        return $view;
    }
public function buildBlock(Model\BlockInterface $block)
    {
        $editable = $this->editor->isEnabled();

        $view = new BlockView();
        $attributes = $view->getAttributes()->addClass('cms-block');

        if ($editable) {
            $row = $block->getRow();

            $attributes
                ->setId('cms-block-' . $block->getId())
                ->setData([
                    'id'       => $block->getId(),
                    'type'     => $block->getType(),
                    'position' => $block->getPosition(),
                    'actions'  => [
                        'add'         => !is_null($row),
                        'edit'        => false,
                        'layout'      => true,
                        'change_type' => !$block->isNamed(),
                        'move_left'   => !$block->isFirst(),
                        'move_right'  => !$block->isLast(),
                        'move_up'     => !$block->isAlone() && !$row->isFirst(),
                        'move_down'   => !$block->isAlone() && !$row->isLast(),
                        'remove'      => !$block->isAlone(),
                    ],
                ]);
        }

        $adapter = $this->editor->getLayoutAdapter();

        // Layout
        $adapter->buildBlock($block, $view);

        // Plugin
        $this->editor
            ->getBlockPlugin($block->getType())
            ->render($block, $view, $adapter, [
                'editable' => $editable,
            ]);

        // Set widgets positions
        /*$p = 0;
        foreach ($view->widgets as $widgetView) {
            $widgetView->getAttributes()->setData('position', $p);
            $p++;
        }*/

        return $view;
    }
public function buildBlock ( Model \ BlockInterface $ block ) { $ editable = $ this -> editor -> isEnabled ( ) ; $ view = new BlockView ( ) ; $ attributes = $ view -> getAttributes ( ) -> addClass ( 'cms-block' ) ; if ( $ editable ) { $ row = $ block -> getRow ( ) ; $ attributes -> setId ( 'cms-block-' . $ block -> getId ( ) ) -> setData ( [ 'id' => $ block -> getId ( ) , 'type' => $ block -> getType ( ) , 'position' => $ block -> getPosition ( ) , 'actions' => [ 'add' => ! is_null ( $ row ) , 'edit' => false , 'layout' => true , 'change_type' => ! $ block -> isNamed ( ) , 'move_left' => ! $ block -> isFirst ( ) , 'move_right' => ! $ block -> isLast ( ) , 'move_up' => ! $ block -> isAlone ( ) && ! $ row -> isFirst ( ) , 'move_down' => ! $ block -> isAlone ( ) && ! $ row -> isLast ( ) , 'remove' => ! $ block -> isAlone ( ) , ] , ] ) ; } $ adapter = $ this -> editor -> getLayoutAdapter ( ) ; // Layout $ adapter -> buildBlock ( $ block , $ view ) ; // Plugin $ this -> editor -> getBlockPlugin ( $ block -> getType ( ) ) -> render ( $ block , $ view , $ adapter , [ 'editable' => $ editable , ] ) ; // Set widgets positions /*$p = 0;
        foreach ($view->widgets as $widgetView) {
            $widgetView->getAttributes()->setData('position', $p);
            $p++;
        }*/ return $ view ; }
Builds the block view.

@param Model\BlockInterface $block

@return BlockView
Builds the block view .