diff --git a/typo3/sysext/func/Classes/Controller/PageFunctionsController.php b/typo3/sysext/func/Classes/Controller/PageFunctionsController.php index b2f89c1ee7b782c703a116e7079619314a20fc75..3ece499e34b8f5a221051b3465c2ba52138932e5 100644 --- a/typo3/sysext/func/Classes/Controller/PageFunctionsController.php +++ b/typo3/sysext/func/Classes/Controller/PageFunctionsController.php @@ -62,6 +62,11 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass */ protected $iconFactory; + /** + * @var StandaloneView + */ + protected $view; + /** * Constructor */ @@ -125,28 +130,27 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';'); // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); - $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" id="PageFunctionsController" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />'; - $vContent = $this->moduleTemplate->getVersionSelector($this->id, true); - if ($vContent) { - $this->content .= '<div>' . $vContent . '</div>'; - } - $this->extObjContent(); + + $this->view = $this->getFluidTemplateObject('func', 'func'); + $this->view->assign('moduleName', BackendUtility::getModuleUrl('web_func')); + $this->view->assign('id', $this->id); + $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, true)); + $this->view->assign('functionMenuModuleContent', $this->getExtObjContent()); // Setting up the buttons and markers for docheader $this->getButtons(); $this->generateMenu(); - $this->content .= '</form>'; + $this->content .= $this->view->render(); } else { // If no access or if ID == zero $title = $this->getLanguageService()->getLL('title'); $message = $this->getLanguageService()->getLL('clickAPage_content'); - $view = GeneralUtility::makeInstance(StandaloneView::class); - $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html')); - $view->assignMultiple(array( + $this->view = $this->getFluidTemplateObject('func', 'func', 'InfoBox'); + $this->view->assignMultiple(array( 'title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO )); - $this->content = $view->render(); + $this->content = $this->view->render(); // Setting up the buttons and markers for docheader $this->getButtons(); } @@ -231,4 +235,26 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { return $GLOBALS['BE_USER']; } + + /** + * returns a new standalone view, shorthand function + * + * @param string $extensionName + * @param string $controllerExtensionname + * @param string $templateName + * @return StandaloneView + */ + protected function getFluidTemplateObject($extensionName, $controllerExtensionName, $templateName = 'Main') + { + /** @var StandaloneView $view */ + $view = GeneralUtility::makeInstance(StandaloneView::class); + $view->setLayoutRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:' . $extensionName . '/Resources/Private/Layouts'))); + $view->setPartialRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:' . $extensionName . '/Resources/Private/Partials'))); + $view->setTemplateRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:' . $extensionName . '/Resources/Private/Templates'))); + + $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:' . $extensionName . '/Resources/Private/Templates/' . $templateName . '.html')); + + $view->getRequest()->setControllerExtensionName($controllerExtensionName); + return $view; + } } diff --git a/typo3/sysext/func/Resources/Private/Templates/Main.html b/typo3/sysext/func/Resources/Private/Templates/Main.html new file mode 100644 index 0000000000000000000000000000000000000000..5feda647ac79981a90beaf26caf285e5df5f4860 --- /dev/null +++ b/typo3/sysext/func/Resources/Private/Templates/Main.html @@ -0,0 +1,7 @@ +<form action="{moduleName}" method="post" id="PageFunctionsController"> + <input type="hidden" name="id" value="{id}" /> + <f:if condition="{versionSelector}"> + <div><f:format.raw>{versionSelector}</f:format.raw></div> + </f:if> + <f:format.raw>{functionMenuModuleContent}</f:format.raw> +</form>