/** * Loads the editor configuration * * @param string $configurationPath The typoscript setup path in which the * editor configuration is stored. * * @return string * @throws \TYPO3\CMS\Extbase\Object\InvalidClassException */ protected function initializeJavascriptSetupFromConfiguration($configurationPath) { $this->configuration = $this->typoscriptReader->loadTyposcriptFromPath($configurationPath); if ($this->cache->has('bbcodeeditor-jsonconfig')) { return $this->javascriptSetup = $this->cache->get('bbcodeeditor-jsonconfig'); } foreach ($this->configuration['panels.'] as $key => $panelConfiguration) { $panel = $this->objectManager->get($panelConfiguration['className']); if (!$panel instanceof \Mittwald\Typo3Forum\TextParser\Panel\PanelInterface) { throw new \TYPO3\CMS\Extbase\Object\InvalidClassException('Expected an implementation of the \\Mittwald\\Typo3Forum\\TextParser\\Panel\\PanelInterface interface!', 1315835842); } $panel->setSettings($panelConfiguration); $this->panels[] = $panel; } $this->javascriptSetup = ' <script language="javascript"> ' . 'var bbcodeSettings = ' . json_encode($this->getPanelSettings()) . ';' . '$(document).ready(function() {' . '$(\'#' . $this->arguments['id'] . '\').markItUp(bbcodeSettings);' . '}); </script>'; $this->cache->set('bbcodeeditor-jsonconfig', $this->javascriptSetup); return $this->javascriptSetup; }
/** * Loads the text parser configuration from a certain configuration path. * * @param string $configurationPath The typoscript configuration path. * * @return void * @throws \Mittwald\Typo3Forum\Domain\Exception\TextParser\Exception */ public function loadConfiguration($configurationPath = 'plugin.tx_typo3forum.settings.textParsing') { if ($this->settings !== NULL) { return; } $this->settings = $this->typoscriptReader->loadTyposcriptFromPath($configurationPath); foreach ($this->settings['enabledServices.'] as $key => $className) { if (substr($key, -1, 1) === '.') { continue; } /** @var $newService \Mittwald\Typo3Forum\TextParser\Service\AbstractTextParserService */ $newService = $this->objectManager->get($className); if ($newService instanceof \Mittwald\Typo3Forum\TextParser\Service\AbstractTextParserService) { $newService->setSettings((array) $this->settings['enabledServices.'][$key . '.']); $newService->setControllerContext($this->controllerContext); $this->parsingServices[] = $newService; } else { throw new \Mittwald\Typo3Forum\Domain\Exception\TextParser\Exception('Invalid class; expected an instance of \\Mittwald\\Typo3Forum\\TextParser\\Service\\AbstractTextParserService!', 1315916625); } } }