_blockName = $blockName; $this->_parentPlugin = $parentPlugin; parent::__construct(); } /** * Get the management plugin * @return CustomBlockManagerPlugin */ function getManagerPlugin() { return $this->_parentPlugin; } /** * @copydoc Plugin::getName() */ function getName() { return $this->_blockName; } /** * @copydoc Plugin::getPluginPath() */ function getPluginPath() { $plugin = $this->getManagerPlugin(); return $plugin->getPluginPath(); } /** * @copydoc Plugin::getTemplatePath() */ function getTemplatePath($inCore = false) { $plugin = $this->getManagerPlugin(); return $plugin->getTemplatePath($inCore); } /** * @copydoc Plugin::getHideManagement() */ function getHideManagement() { return true; } /** * @copydoc LazyLoadPlugin::getEnabled() */ function getEnabled() { if (!Config::getVar('general', 'installed')) return true; return parent::getEnabled(); } /** * @copydoc Plugin::getDisplayName() */ function getDisplayName() { return $this->_blockName . ' ' . __('plugins.generic.customBlock.nameSuffix'); } /** * @copydoc Plugin::getDescription() */ function getDescription() { return __('plugins.generic.customBlock.description'); } /** * @copydoc BlockPlugin::getContents() */ function getContents($templateMgr, $request = null) { $context = $request->getContext(); $contextId = $context ? $context->getId() : 0; // Get the block contents. $customBlockContent = $this->getSetting($contextId, 'blockContent'); $currentLocale = AppLocale::getLocale(); $contextPrimaryLocale = $context?$context->getPrimaryLocale():$request->getSite()->getPrimaryLocale(); $divCustomBlockId = 'customblock-'.preg_replace('/\W+/', '-', $this->getName()); $templateMgr->assign('customBlockId', $divCustomBlockId); $content = $customBlockContent[$currentLocale] ? $customBlockContent[$currentLocale] : $customBlockContent[$contextPrimaryLocale]; $templateMgr->assign('customBlockContent', $content); return parent::getContents($templateMgr, $request); } /** * @copydoc BlockPlugin::getBlockContext() */ function getBlockContext() { if (!Config::getVar('general', 'installed')) return BLOCK_CONTEXT_SIDEBAR; return parent::getBlockContext(); } /** * @copydoc BlockPlugin::getSeq() */ function getSeq($contextId = null) { if (!Config::getVar('general', 'installed')) return 1; return parent::getSeq($contextId); } } ?>