public function delete(Model\BlockInterface $block)
    {
        // Ensure not named / alone
        if ($block->isAlone() || $block->isNamed()) {
            throw new InvalidOperationException(
                "The block can't be removed because it is named or the parent row does not have enough children."
            );
        }

        if (null === $row = $block->getRow()) {
            throw new InvalidOperationException(
                "This block does not belong to a row and therefore can't be removed."
            );
        }

        // Plugin remove
        $this->editor
            ->getBlockPlugin($block->getType())
            ->remove($block);

        // Remove from row
        $row->removeBlock($block);

        // Fix row's blocks positions
        $this->editor
            ->getRowManager()
            ->fixBlocksPositions($row);

        return $block;
    }
public function delete(Model\BlockInterface $block)
    {
        // Ensure not named / alone
        if ($block->isAlone() || $block->isNamed()) {
            throw new InvalidOperationException(
                "The block can't be removed because it is named or the parent row does not have enough children."
            );
        }

        if (null === $row = $block->getRow()) {
            throw new InvalidOperationException(
                "This block does not belong to a row and therefore can't be removed."
            );
        }

        // Plugin remove
        $this->editor
            ->getBlockPlugin($block->getType())
            ->remove($block);

        // Remove from row
        $row->removeBlock($block);

        // Fix row's blocks positions
        $this->editor
            ->getRowManager()
            ->fixBlocksPositions($row);

        return $block;
    }
public function delete ( Model \ BlockInterface $ block ) { // Ensure not named / alone if ( $ block -> isAlone ( ) || $ block -> isNamed ( ) ) { throw new InvalidOperationException ( "The block can't be removed because it is named or the parent row does not have enough children." ) ; } if ( null === $ row = $ block -> getRow ( ) ) { throw new InvalidOperationException ( "This block does not belong to a row and therefore can't be removed." ) ; } // Plugin remove $ this -> editor -> getBlockPlugin ( $ block -> getType ( ) ) -> remove ( $ block ) ; // Remove from row $ row -> removeBlock ( $ block ) ; // Fix row's blocks positions $ this -> editor -> getRowManager ( ) -> fixBlocksPositions ( $ row ) ; return $ block ; }
Deletes the block.

@param Model\BlockInterface $block

@return Model\BlockInterface The removed block.
@throws InvalidOperationException
Deletes the block .