Skip to content
Snippets Groups Projects
Commit 35ad45c0 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Frank Naegler
Browse files

[TASK] Fluidification of Function Module

Moved all HTML code from the PHP code to an own Fluid template.

Resolves: #74382
Releases: master
Change-Id: I840cf5ebb4acc758751da143f5a0360c7024c0ab
Reviewed-on: https://review.typo3.org/47144


Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent dc28f0ee
Branches
Tags
No related merge requests found
......@@ -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;
}
}
<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>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment