Skip to content
Snippets Groups Projects

[FEATURE] add new optional FluidRenderer

Merged Philipp Nowinski requested to merge feature_fluidRenderer into master
3 unresolved threads
1 file
+ 1
0
Compare changes
  • Side-by-side
  • Inline
@@ -29,6 +29,7 @@ use SGalinski\DfTabs\DataProvider\AbstractBaseDataProvider;
use SGalinski\DfTabs\Domain\Repository\TabRepository;
use SGalinski\DfTabs\Service\ConfigurationService;
use SGalinski\DfTabs\View\TypoScriptView;
use SGalinski\DfTabs\View\FluidView;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -82,17 +83,25 @@ class PluginController extends AbstractPlugin {
* Returns an instance of the renderer
*
* @param string $tabId
* @return TypoScriptView
* @return FluidView
*/
protected function getRenderer($tabId) {
/** @var TypoScriptFrontendController $tsfe */
$tsfe = $GLOBALS['TSFE'];
/** @var $renderer TypoScriptView */
$renderer = GeneralUtility::makeInstance(TypoScriptView::class);
$renderer->injectPluginConfiguration($this->pluginConfiguration, $tabId);
$renderer->injectPageRenderer(GeneralUtility::makeInstance(PageRenderer::class));
$renderer->injectContentObject($this->cObj);
if ($this->pluginConfiguration['renderer'] === 'TypoScript' || !$this->pluginConfiguration['renderer']) {
/** @var $renderer TypoScriptView */
$renderer = GeneralUtility::makeInstance(TypoScriptView::class);
$renderer->injectPluginConfiguration($this->pluginConfiguration, $tabId);
$renderer->injectPageRenderer(GeneralUtility::makeInstance(PageRenderer::class));
$renderer->injectContentObject($this->cObj);
$repository = $this->getTabRepository();
$records = $repository->getRecords();
$renderer->addInlineJavaScriptCode($records, $this->pluginConfiguration['mode'], $tabId);
} else if ($this->pluginConfiguration['renderer'] === 'Fluid') {
/** @var $renderer FluidView */
$renderer = GeneralUtility::makeInstance(FluidView::class);
}
return $renderer;
}
@@ -149,7 +158,6 @@ class PluginController extends AbstractPlugin {
$records = $repository->getRecords();
$tabElements = $repository->buildTabElements($this->pluginConfiguration['titles'] ?? [], $records);
$content .= $renderer->renderTabs($tabElements, $tabId);
$renderer->addInlineJavaScriptCode($records, $this->pluginConfiguration['mode'], $tabId);
} catch (\Exception $exception) {
$content = $exception->getMessage();
Loading