@param BlockInterface $block

@return array
334892
public function getColumnClasses(BlockInterface $block)
    {
        $spanStyles = array();

        if ($block->getColumnCount()) {
            $properties = $block->getProperties();
            if (isset($properties['spans']) && count($properties['spans']) > 0) {
                foreach ($properties['spans'] as $screen => $cols) {
                    if (!$cols) {
                        continue;
                    }
                    foreach ($cols as $col => $span) {
                        if (empty($span)) {
                            continue;
                        }
                        $spanStyles[$col][] = "col-$screen-$span";
                    }
                }
            } else {
                $columnCount = $block->getColumnCount();
                $spanStyles = array_fill_keys(range(0, $columnCount), 'col-xs-'.(12 / $columnCount));
            }
        }

        return $spanStyles;
    }
592639
protected function getNodes(ReadBlockInterface $block)
    {
        $nodes = null;
        $nodeName = $block->getAttribute('nodeName');
        $siteId = $this->currentSiteManager->getSiteId();

        if (!is_null($nodeName)) {
            $nodes = $this->nodeRepository->getSubMenu($nodeName, $block->getAttribute('nbLevel'), $this->request->getLocale(), $siteId);
            $nodes = $this->getGrantedNodes($nodes);
        }

        return $nodes;
    }
601363
public function getManageViewParameters(BlockInterface $block)
    {
        $parameters = [
            'block_view' => $this->getView($block),
            'manage' => true,
            'manage_type' => $this->getManageFormTypeName(),
        ];

        return $parameters;
    }
1155525
public function show(ReadBlockInterface $block)
    {
        $formParameters = array('method' => 'GET');

        if ('' != $block->getAttribute('contentNodeId')) {
            $language = $this->currentSiteManager->getSiteLanguage();
            $siteId = $this->currentSiteManager->getSiteId();
            $nodeId = $this->nodeRepository->findOnePublished($block->getAttribute('contentNodeId'), $language, $siteId)->getId();
            $formParameters['action'] = $this->router->generate($nodeId);
        }

        $formData = $this->requestStack->getCurrentRequest()->get('elastica_search');
        $form = $this->formFactory->create(new SearchType(), $formData, $formParameters);

        return $this->render('OpenOrchestraElasticaFrontBundle:Block/Search:show.html.twig', array(
            'form' => $form->createView(),
            'id' => $block->getId(),
            'class' => $block->getStyle(),
        ));
    }
410524
public function save(BlockInterface $block)
    {
        $block->setRootVersion($this->getNewVersion($block));

        $this->em->persist($block);
        $this->em->flush($block);

        return $this;
    }
1344230
public function show(ReadBlockInterface $block)
    {
        $parameters = $this->requestStack->getMasterRequest()->get('_route_params');
        if (!array_key_exists('siteId', $parameters) || !array_key_exists('nodeId', $parameters)) {
            throw new RouteNotFoundException();
        }
        $site = $this->siteRepository->findOneBySiteId($parameters['siteId']);
        $routes = array();
        if (!\is_null($site)) {
            foreach ($site->getLanguages() as $language) {
                try {
                    unset($parameters['_locale']);
                    unset($parameters['aliasId']);

                    $routes[$language] = $this->urlGenerator->generate($parameters['nodeId'], array_merge(
                        $parameters,
                        array(OpenOrchestraDatabaseUrlGenerator::REDIRECT_TO_LANGUAGE => $language)
                    ));
                } catch (ResourceNotFoundException $e) {
                } catch (RouteNotFoundException $e) {
                } catch (MissingMandatoryParametersException $e) {
                }
            }
        }

        return $this->render(
            $this->template,
            array(
                'class' => $block->getStyle(),
                'id' => $block->getId(),
                'routes' => $routes,
            )
        );
    }
88064
protected function getLastRow(BlockInterface $block)
    {
        if ($block->hasAttribute('last_row')) {
            $row = $block->get($block->getAttribute('last_row'));

            // return current row
            if (\count($row) < $row->getOption('column')) {
                return $row;
            }
        }

        // new row
        $rowName = BlockUtil::createUniqueName();
        $block->add($rowName, PanelRowType::class);

        return $block->get($rowName);
    }
108173
public function getDefaultConfiguration(BlockInterface $block)
    {
        /** @var GenerateFormInterface $strategy */
        foreach ($this->strategies as $strategy) {
            if ($strategy->support($block)) {
                return $strategy->getMergedDefaultConfiguration();
            }
        }

        throw new MissingGenerateFormStrategyException();
    }
919653
public function getBlockPropertySet(Block $block)
	{
		$blockPropertySet = new BlockPropertySet();
		
		/* @var $blockProperty \Supra\Package\Cms\Entity\BlockProperty */
		foreach ($this as $blockProperty) {
			if ($blockProperty->getBlock()->equals($block)) {
				$blockPropertySet->append($blockProperty);
			}
		}
		
		return $blockPropertySet;
	}
885160
private function getBlockPaths(\Magento\Framework\View\Element\AbstractBlock $block)
    {
        $reflector     = new \ReflectionClass($block); //@codingStandardsIgnoreLine
        $classFileName = $reflector->getFileName();

        if ($block instanceof \Magento\Framework\Interception\InterceptorInterface) {
            $classFileName = $reflector->getParentClass()->getFileName();
        }

        return ['class' => $classFileName];
    }
299564
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;
    }
440044
protected function getEventBlocks(BlockEvent $event)
    {
        $results = [];

        foreach ($event->getBlocks() as $block) {
            $results[] = [$block->getId(), $block->getType()];
        }

        return $results;
    }
367298
protected function getDailymotionParameters(ReadBlockInterface $block)
    {
        $urlParams = array();

        foreach (array('dailymotionAutoplay', 'dailymotionChromeless') as $key) {
            if ($block->getAttribute($key) === true) {
                $urlParams[strtolower(substr($key, 11))] = 1;
            }
        }
        foreach (array('dailymotionLogo', 'dailymotionInfo', 'dailymotionRelated') as $key) {
            if ($block->getAttribute($key) === false) {
                $urlParams[strtolower(substr($key, 11))] = 0;
            }
        }
        foreach (array('dailymotionBackground', 'dailymotionForeground', 'dailymotionHighlight', 'dailymotionQuality') as $key) {
            if ($block->getAttribute($key) !== '') {
                $urlParams[strtolower(substr($key, 11))] = $block->getAttribute($key);
            }
        }

        $url = "//www.dailymotion.com/embed/video/" . $block->getAttribute('dailymotionVideoId') . "?" . http_build_query($urlParams);

        return array(
            'url' => $url,
            'width' => $block->getAttribute('dailymotionWidth'),
            'height' => $block->getAttribute('dailymotionHeight')
        );
    }
923654
public function show(ReadBlockInterface $block)
    {
        $nodes = $this->getNodes($block);

        if (!is_null($nodes)) {
            return $this->render(
                'OpenOrchestraDisplayBundle:Block/Menu:tree.html.twig',
                array(
                    'tree' => $nodes,
                    'id' => $block->getId(),
                    'class' => $block->getStyle(),
                )
            );
        }

        throw new NodeNotFoundException($block->getAttribute('nodeName'));
    }
212492
public function show(ReadBlockInterface $block)
    {
        $template = 'OpenOrchestraDisplayBundle:Block/Video:show.html.twig';
        $parameters = array(
            'class' => $block->getStyle(),
            'id' => $block->getId()
        );

        switch($block->getAttribute('videoType'))
        {
            case 'youtube':
                $template = 'OpenOrchestraDisplayBundle:Block/Video:youtube.html.twig';
                $parameters = array_merge(
                    $parameters,
                    $this->getYoutubeParameters($block)
                );
                break;

            case 'dailymotion':
                $template = 'OpenOrchestraDisplayBundle:Block/Video:dailymotion.html.twig';
                $parameters = array_merge(
                    $parameters,
                    $this->getDailymotionParameters($block)
                );
                break;

            case 'vimeo':
                $template = 'OpenOrchestraDisplayBundle:Block/Video:vimeo.html.twig';
                $parameters = array_merge(
                    $parameters,
                    $this->getVimeoParameters($block)
                );
                break;
        }

        return $this->render($template, $parameters);
    }
1154258
private function get_tags(string $block){
    preg_match_all($this->pattern['tag'], $block, $tags, PREG_OFFSET_CAPTURE);
    if ( !empty($tags[0]) ){
      return $tags[0];
    }
    return [];
  }
1222173
public function revertSingle(BlockInterface $block, $version)
    {
        // check for LogEntries
        /** @var BlockLogEntryRepository $repo */
        $repo = $this->em->getRepository('OpiferContentBundle:BlockLogEntry');

        $logs = $repo->getLogEntriesRoot($block, $version);

        if (count($logs)) {
            $latest = current($logs)->getVersion();
            $repo->revert($block, $latest);  // We "revert" to the current working draft, as the Block itself is a published one
        } else {
            if ($block->getVersion() > $version) {
                // no logs where found, assume block was created in a later version
                $block->getParent()->removeChild($block);
                unset($block);
            }
        }
    }