public function renderInitCmsBlock($template, LayoutBlockInterface $layoutBlock, $params = array())
{
/** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */
$layoutBlockAdmin = $this->getService('networking_init_cms.admin.layout_block');
if (!($serializedContent = $layoutBlock->getSnapshotContent())) {
// Draft View
$contentItem = $layoutBlock->getContent();
} else {
// Live View
$contentItem = $this->getService('serializer')->deserialize($serializedContent, $layoutBlock->getClassType(), 'json');
}
if (!is_object($contentItem)) {
$layoutBlockAdmin->delete($layoutBlock);
return '---';
}
$options = $contentItem->getTemplateOptions($params);
$options = array_merge($options, $params);
return $this->getService('templating')->render($template, $options);
}