Networking\InitCmsBundle\Twig\Extension\NetworkingHelperExtension::renderInitcmsAdminBlock PHP Method

renderInitcmsAdminBlock() public method

Returns an HTML block for output in the admin area
public renderInitcmsAdminBlock ( Networking\InitCmsBundle\Model\LayoutBlockInterface $layoutBlock ) : boolean
$layoutBlock Networking\InitCmsBundle\Model\LayoutBlockInterface
return boolean
    public function renderInitcmsAdminBlock(LayoutBlockInterface $layoutBlock)
    {
        /** @var \Sonata\AdminBundle\Admin\AdminInterface $layoutBlockAdmin */
        $layoutBlockAdmin = $this->getService('networking_init_cms.admin.layout_block');
        if ($layoutBlock->getObjectId()) {
            // Draft View
            $contentItem = $layoutBlock->getContent();
        } else {
            $classType = $layoutBlock->getClassType();
            $contentItem = new $classType();
        }
        if (!is_object($contentItem)) {
            $layoutBlockAdmin->delete($layoutBlock);
            return false;
        }
        $adminContent = $contentItem->getAdminContent();
        return $this->getService('templating')->render($adminContent['template'], $adminContent['content']);
    }