Skip to content
Snippets Groups Projects
Commit 6fc46ad7 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Christian Kuhn
Browse files

[TASK] Fluidification of Info Module

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

Resolves: #74360
Releases: master
Change-Id: Ib583695d8b95140347c4107d6183fbbde9f309eb
Reviewed-on: https://review.typo3.org/47129


Reviewed-by: default avatarJan Helke <typo3@helke.de>
Tested-by: default avatarJan Helke <typo3@helke.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 3ce0a596
Branches
Tags
No related merge requests found
......@@ -358,6 +358,21 @@ class BaseScriptClass
}
}
/**
* Return the content of the 'main' function inside the "Function menu module" if present
*
* @return string
*/
public function getExtObjContent()
{
$savedContent = $this->content;
$this->content = '';
$this->extObjContent();
$newContent = $this->content;
$this->content = $savedContent;
return $newContent;
}
/**
* Returns the Language Service
* @return LanguageService
......
......@@ -22,6 +22,7 @@ use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
/**
* Script Class for the Web > Info module
......@@ -58,6 +59,11 @@ class InfoModuleController extends BaseScriptClass
*/
protected $moduleTemplate;
/**
* @var StandaloneView
*/
protected $view;
/**
* Constructor
*/
......@@ -107,17 +113,15 @@ class InfoModuleController extends BaseScriptClass
);
// Setting up the context sensitive menu:
$this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
$this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) .
'" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">';
$vContent = $this->moduleTemplate->getVersionSelector($this->id, 1);
if ($vContent) {
$this->content .= '<div>' . $vContent . '</div>';
}
$this->extObjContent();
$this->view = $this->getFluidTemplateObject();
$this->view->assign('moduleName', htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)));
$this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, 1));
$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
$this->content = $this->moduleTemplate->header($this->languageService->getLL('title'));
......@@ -229,4 +233,23 @@ class InfoModuleController extends BaseScriptClass
{
return $this->moduleTemplate;
}
/**
* returns a new standalone view, shorthand function
*
* @return StandaloneView
*/
protected function getFluidTemplateObject()
{
/** @var StandaloneView $view */
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setLayoutRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:info/Resources/Private/Layouts')));
$view->setPartialRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:info/Resources/Private/Partials')));
$view->setTemplateRootPaths(array(GeneralUtility::getFileAbsFileName('EXT:info/Resources/Private/Templates')));
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:info/Resources/Private/Templates/Main.html'));
$view->getRequest()->setControllerExtensionName('info');
return $view;
}
}
<form action="{moduleName}" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">
<f:if condition="{versionSelector}">
<div>{versionSelector}</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