Пример #1
0
 /**
  * @param $name
  * @deprecated remove at Core-2.0
  * @return null|\Zikula\Core\AbstractBundle
  */
 public function getModuleInstanceOrNull($name)
 {
     $moduleInstance = null;
     try {
         $moduleInstance = $this->kernel->getModule($name);
     } catch (\Exception $e) {
         // silent fail
         // @todo remove this try/catch block at Core-2.0
     }
     return $moduleInstance;
 }
Пример #2
0
 public function upgradeBkeyToFqClassname(KernelInterface $kernel, BlockEntity $blockEntity)
 {
     $moduleName = $blockEntity->getModule()->getName();
     try {
         $moduleBundle = $kernel->getModule($moduleName);
         $blockClassName = $moduleBundle->getNamespace() . '\\Block\\' . ucwords($blockEntity->getBkey());
         $blockClassName = preg_match('/.*Block$/', $blockClassName) ? $blockClassName : $blockClassName . 'Block';
     } catch (\Exception $e) {
         $moduleBundle = null;
         $blockClassName = '\\' . ucwords($moduleName) . '\\' . 'Block\\' . ucwords($blockEntity->getBkey());
         $blockClassName = preg_match('/.*Block$/', $blockClassName) ? $blockClassName : $blockClassName . 'Block';
         $blockClassNameOld = '\\' . ucwords($moduleName) . '_' . 'Block_' . ucwords($blockEntity->getBkey());
         $blockClassName = class_exists($blockClassName) ? $blockClassName : $blockClassNameOld;
     }
     return "{$moduleName}:{$blockClassName}";
 }