Get the content type of the content object, if the object is new, use the first available type.

@param LayoutBlockInterface $layoutBlock

@return string
559877
public function getContentType(LayoutBlockInterface $layoutBlock = null)
	{
		if (is_null($layoutBlock) || !$classType = $layoutBlock->getClassType()) {
			if ($this->contentType) {
				return $this->contentType;
			}

			$contentTypes = $this->getContentTypes();

			$classType = $contentTypes[0]['class'];
		}

		return $classType;
	}
447897
public function show(ReadBlockInterface $block)
    {
        $parameters = $this->getParameters();

        $currentPage = $this->request->get(NavigatorExtension::PARAMETER_PAGE);
        if (!$currentPage) {
            $currentPage = 1;
        }

        return $this->render(
            $this->template,
            array(
                'galleryClass' => $block->getStyle(),
                'id' => $block->getId(),
                'pictures' => $this->filterMedias($block->getAttribute('pictures'), $currentPage, $block->getAttribute('itemNumber')),
                'numberOfColumns' => $block->getAttribute('columnNumber'),
                'thumbnailFormat' => $block->getAttribute('thumbnailFormat'),
                'imageFormat' => $block->getAttribute('imageFormat'),
                'numberOfPages' => ($block->getAttribute('itemNumber') == 0) ? 1 : ceil(count($block->getAttribute('pictures')) / $block->getAttribute('itemNumber')),
                'parameters' => $parameters,
                'currentPage' => $currentPage,
                'width' => $block->getAttribute('width'),
            )
        );
    }
10216
protected function getStrategy(ReadBlockInterface $block)
    {
        if (isset($this->cachedStrategies[$block->getId()])) {
            return $this->cachedStrategies[$block->getId()];
        }

        foreach ($this->strategies as $strategy) {
            if ($strategy->support($block)) {
                if ($block->getId()) {
                    $this->cachedStrategies[$block->getId()] = $strategy;
                }

                return $strategy;
            }
        }

        return null;
    }
1227156
public function resolve(ContentInterface $content)
    {
        $contentType = $this->contentTypeLoader->retrieveAll()
            ->filter(function (ContentTypeInterface $contentType) use ($content) {
                return is_a($content, $contentType->getContentClass());
            })
            ->first()
        ;
        if (!$contentType) {
            throw new InvalidContentException(sprintf(
                'No content type registered for "%s" content, check you configuration.',
                is_string($content) ? $content : get_class($content)
            ));
        }

        return $this->wrap($contentType, $content);
    }
289793
public function getBlockTypeClass()
    {
        return \Concrete\Core\Block\BlockType\BlockType::getBlockTypeMappedClass($this->getBlockTypeHandle(), $this->getPackageHandle());
    }
142935
private function getAllowedBlocks(Zone $zone, LayoutTypeInterface $layoutType)
    {
        if ($layoutType->hasZone($zone->getIdentifier())) {
            $layoutTypeZone = $layoutType->getZone($zone->getIdentifier());
            $allowedBlockDefinitions = $layoutTypeZone->getAllowedBlockDefinitions();

            if (count($allowedBlockDefinitions) > 0) {
                return $allowedBlockDefinitions;
            }
        }

        return true;
    }
481641
public function getBlockById(int $blockId, int $siteId = null)
    {
        /** @var SuperTableBlock|null $block */
        $block = Craft::$app->getElements()->getElementById($blockId, SuperTableBlockElement::class, $siteId);

        return $block;
    }
683729
public function setBlock(BlockInterface $block)
    {
        $this->subject->setBlock($block);
        $this->block = $block;

        return $this;
    }
1261945
private function getBlock()
    {
        return isset($this->_blocks[$this->_pos]) ? $this->_blocks[$this->_pos] : NULL;
    }
768067
public function getLayoutTemplate(string $context = ViewInterface::CONTEXT_DEFAULT): ?string
    {
        $layoutView = $this->buildLayoutView($context);
        if (!$layoutView instanceof LayoutViewInterface) {
            return $this->getPageLayoutTemplate();
        }

        return $layoutView->getTemplate();
    }
596787
public function show(ReadBlockInterface $block)
    {
        $nodes = $this->getNodes();

        return $this->render(
            'OpenOrchestraDisplayBundle:Block/Menu:tree.html.twig',
            array(
                'tree' => $nodes,
                'id' => $block->getId(),
                'class' => $block->getStyle(),
            )
        );
    }
973848
public function getBlockFilter(BlockInterface $block)
    {
        $type = $block->getType();

        $name = isset($this->blockFilters[$type]) ? $this->blockFilters[$type] : $this->defaultFilter;
        $service = $this->getFilterService($name);

        if (!$service instanceof FilterInterface) {
            throw new \RuntimeException(sprintf('The service "%s" is not an exception filter', $name));
        }

        return $service;
    }
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;
    }
151688
protected function loadCollection(BlockInterface $block)
    {
        $properties = $block->getProperties();

        $conditions = (isset($properties['conditions'])) ? $properties['conditions'] : '[]';
        $conditions = $this->expressionEngine->deserialize($conditions);

        if (empty($conditions)) {
            return;
        }

        $site = $this->siteManager->getSite();

        $qb = $this->expressionEngine->toQueryBuilder($conditions, $this->contentManager->getClass());
        $qb->andWhere('a.publishAt < :now OR a.publishAt IS NULL')
            ->andWhere('a.active = :active')
            ->andWhere('a.layout = :layout');

        if ($site == null) {
            $qb->andWhere('a.site IS NULL');
        } else {
            $qb->andWhere('a.site = :site')
               ->setParameter('site', $site);
        }

        $qb->setParameter('active', true)
            ->setParameter('layout', false)
            ->setParameter('now', new \DateTime());

        if (isset($properties['order_by'])) {
            $direction = (isset($properties['order_direction'])) ? $properties['order_direction'] : 'ASC';

            $qb->orderBy('a.'.$properties['order_by'], $direction);
        }

        $limit = (isset($properties['limit'])) ? $properties['limit'] : 10;
        $qb->setMaxResults($limit);

        $collection = $qb->getQuery()->getResult();

        if ($collection) {
            $block->setCollection($collection);
        }
    }
1207410
protected function getLayoutIdentifier($layoutName = 'Default')
    {
        $layoutPathAndFilename = $this->getLayoutPathAndFilename($layoutName);
        $prefix = 'layout_' . $layoutName;
        return $this->createIdentifierForFile($layoutPathAndFilename, $prefix);
    }
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(),
        ));
    }
1094603
public function render(AbstractBlock $block, CliRenderer $renderer)
    {
        if (!($block instanceof Heading)) {
            throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
        }

        $level  = $block->getLevel();
        $text   = $renderer->renderInlines($block->children());

        return sprintf(
            "\n%s %s\n",
            $renderer->style(str_repeat('#', $level), 'dark_gray'),
            $renderer->style($text, ['bold', 'cyan'])
        );
    }