Commit 92a8f623 authored by Frank Nägler's avatar Frank Nägler Committed by Christian Kuhn
Browse files

[TASK] Cleanup usage of InfoboxViewHelper

In several places in the core, the InfoboxViewHelper was used in controller
context. This patch changes this and makes use of a StandaloneView.

Resolves: #66753
Related: #66723
Releases: master
Change-Id: I16044a4c663aad4eb0cffce0b11bbf63047118f5
Reviewed-on: http://review.typo3.org/39205

Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent ede2d2cf
......@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
/**
......@@ -399,17 +400,15 @@ class PageLayoutController {
$title = $GLOBALS['LANG']->getLL('goToListModule');
$message = '<p>' . $GLOBALS['LANG']->getLL('goToListModuleMessage') . '</p>';
$message .= '<a class="btn btn-info" href="javascript:top.goToModule(\'web_list\',1);">' . $GLOBALS['LANG']->getLL('goToListModule') . '</a>';
// @todo Usage of InfoboxViewHelper this way is pretty ugly, but the best way at the moment
// A complete refactoring is necessary at this point
$arguments = array(
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array(
'title' => $title,
'message' => $message,
'state' => InfoboxViewHelper::STATE_INFO,
'iconName' => NULL,
'disableIcon' => FALSE,
);
$renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
$content .= InfoboxViewHelper::renderStatic($arguments, function() {}, $renderingContext);
'state' => InfoboxViewHelper::STATE_INFO
));
$content .= $view->render();
}
}
// If content from different pid is displayed
......@@ -624,17 +623,15 @@ class PageLayoutController {
$title = $GLOBALS['LANG']->getLL('clickAPage_header');
$message = $GLOBALS['LANG']->getLL('clickAPage_content');
// @todo Usage of InfoboxViewHelper this way is pretty ugly, but the best way at the moment
// A complete refactoring is necessary at this point
$arguments = array(
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array(
'title' => $title,
'message' => $message,
'state' => InfoboxViewHelper::STATE_INFO,
'iconName' => NULL,
'disableIcon' => FALSE,
);
$renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
$body .= InfoboxViewHelper::renderStatic($arguments, function() {}, $renderingContext);
'state' => InfoboxViewHelper::STATE_INFO
));
$body .= $view->render();
// Setting up the buttons and markers for docheader
$docHeaderButtons = array(
......
<f:be.infobox title="{title}" state="{state}">
<f:format.html>{message}</f:format.html>
</f:be.infobox>
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Func\Controller;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
/**
......@@ -102,17 +103,14 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
// If no access or if ID == zero
$title = $this->getLanguageService()->getLL('title');
$message = $this->getLanguageService()->getLL('clickAPage_content');
// @todo Usage of InfoboxViewHelper this way is pretty ugly, but the best way at the moment
// A complete refactoring is necessary at this point
$arguments = array(
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array(
'title' => $title,
'message' => $message,
'state' => InfoboxViewHelper::STATE_INFO,
'iconName' => NULL,
'disableIcon' => FALSE,
);
$renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
$this->content = InfoboxViewHelper::renderStatic($arguments, function() {}, $renderingContext);
'state' => InfoboxViewHelper::STATE_INFO
));
$this->content = $view->render();
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
......
<f:be.infobox title="{title}" state="{state}">
<f:format.html>{message}</f:format.html>
</f:be.infobox>
......@@ -24,6 +24,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
/**
......@@ -358,17 +359,15 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
$title = $lang->getLL('noTemplate');
$message = '<p>' . $lang->getLL('noTemplateDescription') . '<br />' . $lang->getLL('createTemplateToEditConfiguration') . '</p>';
// @todo Usage of InfoboxViewHelper this way is pretty ugly, but the best way at the moment
// A complete refactoring is necessary at this point
$arguments = array(
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array(
'title' => $title,
'message' => $message,
'state' => InfoboxViewHelper::STATE_INFO,
'iconName' => NULL,
'disableIcon' => FALSE,
);
$renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
$theOutput = InfoboxViewHelper::renderStatic($arguments, function() {}, $renderingContext);
'state' => InfoboxViewHelper::STATE_INFO
));
$theOutput = $view->render();
// New standard?
if ($newStandardTemplate) {
......
......@@ -24,6 +24,7 @@ use TYPO3\CMS\Core\TypoScript\ExtendedTemplateService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
use TYPO3\CMS\Frontend\Page\PageRepository;
......@@ -438,17 +439,14 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends AbstractFu
$title = $lang->getLL('errorsWarnings');
$message = '<p>' . implode($errMsg, '<br />') . '</p>';
// @todo Usage of InfoboxViewHelper this way is pretty ugly, but the best way at the moment
// A complete refactoring is necessary at this point
$arguments = array(
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
$view->assignMultiple(array(
'title' => $title,
'message' => $message,
'state' => InfoboxViewHelper::STATE_WARNING,
'iconName' => NULL,
'disableIcon' => FALSE,
);
$renderingContext = new \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext();
$theOutput .= InfoboxViewHelper::renderStatic($arguments, function() {}, $renderingContext);
'state' => InfoboxViewHelper::STATE_WARNING
));
$theOutput .= $view->render();
}
if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
......
<f:be.infobox title="{title}" state="{state}">
<f:format.html>{message}</f:format.html>
</f:be.infobox>
Supports Markdown
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