/** * Get the html output from the block's `modify` method. * * @deprecated This method is not required in Core-2.0. Simply use * `$output = $blockClassInstance->modify($request, $blockEntity->getContent());` * @param $blockClassInstance * @param BlockEntity $blockEntity * @param Request $request * @return mixed|string */ private function getBlockModifyOutput($blockClassInstance, BlockEntity $blockEntity, Request $request) { $output = ''; if ($blockClassInstance instanceof BlockControllerInterface) { $output = $blockClassInstance->modify($request, $blockEntity->getContent()); } elseif ($blockClassInstance instanceof \Zikula_Controller_AbstractBlock) { // @todo remove this BC at Core-2.0 $blockInfo = \BlockUtil::getBlockInfo($blockEntity->getBid()); $blockInfo = $blockInfo ? $blockInfo : ['content' => '']; $output = call_user_func([$blockClassInstance, 'modify'], $blockInfo); } return $output; }
/** * Display one block. * * @param BlockEntity $block * @param string $positionName @deprecated argument. remove at Core-2.0 * @return string */ public function showBlock(BlockEntity $block, $positionName = '') { $blockInstance = $this->blockApi->createInstanceFromBKey($block->getBkey()); $legacy = false; $content = ''; if ($blockInstance instanceof BlockControllerInterface) { $content = $blockInstance->display($block->getContent()); } elseif ($blockInstance instanceof \Zikula_Controller_AbstractBlock) { // @todo remove at Core-2.0 $legacy = true; $args = \BlockUtil::getBlockInfo($block->getBid()); $args['position'] = $positionName; $content = $blockInstance->display($args); } if (!$legacy) { if (null !== ($moduleInstance = $this->extensionApi->getModuleInstanceOrNull($block->getModule()->getName()))) { // @todo can remove check for null at Core-2.0 // add module stylesheet to page - legacy blocks load stylesheets automatically on ModUtil::load() $moduleInstance->addStylesheet(); } } return $this->themeEngine->wrapBlockContentInTheme($content, $block->getTitle(), $block->getBlocktype(), $block->getBid(), $positionName, $legacy); }