[TASK] Streamline usage of PageRenderer 31/41131/3
authorNicole Cordes <typo3@cordes.co>
Mon, 13 Jul 2015 15:07:29 +0000 (17:07 +0200)
committerBenjamin Mack <benni@typo3.org>
Tue, 14 Jul 2015 20:11:20 +0000 (22:11 +0200)
The PageRenderer is a Singleton and only one instance exists during
runtime. This patch cleans up the usage and prevents sharing the
PageRenderer object over public getters. This helps to improve the api
and get rid of unnecessary functions.

Releases: master
Resolves: #68074
Change-Id: I66abd565df96ff0b8fb31d24a04721ca8ecb3f3a
Reviewed-on: http://review.typo3.org/41131
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
54 files changed:
typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/LiveSearchToolbarItem.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/BackendLayoutWizardController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Classes/Controller/LoginFramesetController.php
typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
typo3/sysext/backend/Classes/Controller/Wizard/ColorpickerController.php
typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php
typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php
typo3/sysext/backend/Classes/Module/BaseScriptClass.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Template/FrontendDocumentTemplate.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/belog/Classes/Controller/AbstractController.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-68074-DeprecateGetPageRenderer.rst [new file with mode: 0644]
typo3/sysext/extbase/Classes/Mvc/Web/Response.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Be/TriggerViewHelper.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/AbstractBackendViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/impexp/Classes/Hook/BackendControllerHook.php
typo3/sysext/install/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/lowlevel/Classes/View/DatabaseIntegrityView.php
typo3/sysext/mediace/Classes/ContentObject/FlowPlayerContentObject.php
typo3/sysext/mediace/Classes/ContentObject/QuicktimeObjectContentObject.php
typo3/sysext/mediace/Classes/ContentObject/ShockwaveFlashObjectContentObject.php
typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserFramesetController.php
typo3/sysext/recordlist/Classes/RecordList.php
typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php
typo3/sysext/rtehtmlarea/Classes/SelectImage.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/t3editor/Classes/Hook/FileEditHook.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
typo3/sysext/wizard_crpages/Classes/Controller/CreatePagesWizardModuleFunctionController.php
typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php
typo3/sysext/workspaces/Classes/Controller/AbstractController.php

index 658a1c6..3146297 100644 (file)
@@ -14,11 +14,12 @@ namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
+use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
-use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface;
+use TYPO3\CMS\Core\Page\PageRenderer;
 
 /**
  * Render cache clearing toolbar item
@@ -189,12 +190,10 @@ class ClearCacheToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
        /**
index 1d9efd2..c9d9f4b 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
 
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -105,12 +106,10 @@ class LiveSearchToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
 }
index 63c5149..fd893d7 100644 (file)
@@ -14,13 +14,14 @@ namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Http\AjaxRequestHandler;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
-use TYPO3\CMS\Backend\Module\ModuleLoader;
-use TYPO3\CMS\Core\Http\AjaxRequestHandler;
 use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
@@ -759,12 +760,10 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
        /**
index 0e631b4..c5a8d06 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Http\AjaxRequestHandler;
+use \TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\CommandUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -89,8 +90,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface {
                $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
                $this->standaloneView->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/ToolbarMenu/' . static::TOOLBAR_MENU_TEMPLATE);
 
-               $pageRenderer = $this->getPageRenderer();
-               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/SystemInformationMenu');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/SystemInformationMenu');
        }
 
        /**
@@ -350,12 +350,10 @@ class SystemInformationToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
        /**
index 4823fe4..f2eeb7d 100644 (file)
@@ -14,12 +14,13 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository;
 use TYPO3\CMS\Backend\Module\ModuleLoader;
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Rsaauth\RsaEncryptionEncoder;
@@ -87,14 +88,16 @@ class BackendController {
        protected $moduleLoader;
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        * @var PageRenderer
         */
        protected $pageRenderer;
 
        /**
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function getPageRenderer() {
+               GeneralUtility::logDeprecatedFunction();
                return $this->pageRenderer;
        }
 
@@ -109,7 +112,7 @@ class BackendController {
                // Initializes the backend modules structure for use later.
                $this->moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class);
                $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
-               $this->pageRenderer = $this->getDocumentTemplate()->getPageRenderer();
+               $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $this->pageRenderer->loadExtJS();
                // included for the module menu JavaScript, please note that this is subject to change
                $this->pageRenderer->loadJquery();
index adf47b3..274a4b2 100644 (file)
@@ -14,12 +14,13 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
-use TYPO3\CMS\Backend\Template\DocumentTemplate;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
 
 
 /**
@@ -81,7 +82,7 @@ class BackendLayoutWizardController {
                // Initialize document object:
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $pageRenderer = $this->doc->getPageRenderer();
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $pageRenderer->loadExtJS();
                $pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/JavaScript/grideditor.js');
                $pageRenderer->addInlineSetting('ContextHelp', 'moduleUrl', BackendUtility::getModuleUrl('help_cshmanual'));
index ac0f7be..1d8686e 100644 (file)
@@ -14,22 +14,23 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Form\DataPreprocessor;
 use TYPO3\CMS\Backend\Form\FormEngine;
+use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Html\HtmlParser;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Frontend\Page\PageRepository;
-use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
-use TYPO3\CMS\Core\DataHandling\DataHandler;
-use TYPO3\CMS\Backend\Form\DataPreprocessor;
-use TYPO3\CMS\Core\Messaging\FlashMessage;
-use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Frontend\Page\PageRepository;
 
 /**
  * Script Class: Drawing the editing form for editing records in TYPO3.
@@ -679,11 +680,12 @@ class EditDocumentController {
                $this->MCONF['name'] = 'xMOD_alt_doc.php';
                // Create an instance of the document template object
                $this->doc = $GLOBALS['TBE_TEMPLATE'];
-               $this->doc->getPageRenderer()->addInlineLanguageLabelFile('EXT:lang/locallang_alt_doc.xlf');
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               $pageRenderer->addInlineLanguageLabelFile('EXT:lang/locallang_alt_doc.xlf');
+               $pageRenderer->loadPrototype();
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_doc.html');
                $this->doc->form = '<form action="' . htmlspecialchars($this->R_URI) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
-               $this->doc->getPageRenderer()->loadPrototype();
                // override the default jumpToUrl
                $this->doc->JScodeArray['jumpToUrl'] = '
                        function jumpToUrl(URL,formEl) {
index ee522e9..7bee526 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\FormProtection\BackendFormProtection;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
@@ -144,8 +145,8 @@ class LoginController implements \TYPO3\CMS\Core\Http\ControllerInterface {
         * @return string The content to output
         */
        public function main() {
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->getDocumentTemplate()->getPageRenderer();
+               /** @var $pageRenderer PageRenderer */
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Login');
 
                // support placeholders for IE9 and lower
index 2442f1a..84cab9a 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Controller;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Script Class, putting the frameset together.
@@ -40,7 +41,7 @@ class LoginFramesetController {
                $this->getDocumentTemplate()->startPage($title);
 
                // Create the frameset for the window
-               $this->content = $this->getDocumentTemplate()->getPageRenderer()->render(PageRenderer::PART_HEADER) . '
+               $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) . '
                        <frameset rows="*,1">
                                <frame name="login" src="index.php?loginRefresh=1" marginwidth="0" marginheight="0" scrolling="no" noresize="noresize" />
                                <frame name="dummy" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
@@ -66,4 +67,11 @@ class LoginFramesetController {
                return $GLOBALS['TBE_TEMPLATE'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }
index 19fb6e0..b3655c9 100644 (file)
@@ -14,15 +14,16 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Backend\View\PageTreeView;
-use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Workspaces\Service\WorkspaceService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 
 /**
  * Main script class for the page tree navigation frame
@@ -156,8 +157,8 @@ class PageTreeNavigationController {
                // Adding javascript code for drag&drop and the pagetree as well as the click menu code
                $this->doc->getDragDropCode('pages', $dragDropCode);
                $this->doc->getContextMenuCode();
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->doc->getPageRenderer();
+               /** @var $pageRenderer PageRenderer */
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $pageRenderer->loadExtJS();
                $this->doc->JScode .= $this->doc->wrapScriptTags(($this->currentSubScript ? 'top.currentSubScript=unescape("' . rawurlencode($this->currentSubScript) . '");' : '') . '
                // Function, loading the list frame from navigation tree:
index 1526775..b5dd2f1 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
 
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -293,7 +294,7 @@ class ColorpickerController extends AbstractWizardController {
                                'fieldChangeFuncHash' => $this->P['fieldChangeFuncHash'],
                        )
                );
-               $this->content = $this->getDocumentTemplate()->getPageRenderer()->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_HEADER) . '
+               $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) . '
                        <frameset rows="*,1" framespacing="0" frameborder="0" border="0">
                                <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
                                <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
@@ -434,4 +435,11 @@ class ColorpickerController extends AbstractWizardController {
                return $this->fieldChangeFunc && $this->fieldChangeFuncHash && $this->fieldChangeFuncHash === GeneralUtility::hmac($this->fieldChangeFunc);
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }
index 3b6511e..9ae3e67 100644 (file)
@@ -14,15 +14,15 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Form\FormEngine;
+use TYPO3\CMS\Backend\Form\NodeFactory;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
 use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Extbase\Utility\ArrayUtility;
-use TYPO3\CMS\Backend\Form\NodeFactory;
 
 /**
  * Generation of image manipulation TCEform element
@@ -133,8 +133,8 @@ class ImageManipulationElement extends AbstractFormElement {
 
                        $content .= $this->getImageManipulationInfoTable($parameterArray['itemFormElValue']);
 
-                       /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-                       $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
+                       /** @var $pageRenderer PageRenderer */
+                       $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                        $pageRenderer->loadRequireJsModule(
                                'TYPO3/CMS/Backend/ImageManipulation',
                                'function(ImageManipulation){ImageManipulation.initializeTrigger()}' // Initialize after load
index b00c907..9c081f8 100644 (file)
@@ -14,18 +14,18 @@ namespace TYPO3\CMS\Backend\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
-use TYPO3\CMS\Lang\LanguageService;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Tree\TableConfiguration\ExtJsArrayTreeRenderer;
 use TYPO3\CMS\Core\Tree\TableConfiguration\TableConfigurationTree;
 use TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory;
 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Render data as a tree.
@@ -167,8 +167,8 @@ class SelectTreeElement extends AbstractFormElement {
                                $onChange .= 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                        }
                }
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
+               /** @var $pageRenderer PageRenderer */
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $pageRenderer->loadExtJs();
                $pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/tree.js');
                $pageRenderer->addInlineLanguageLabelFile(ExtensionManagementUtility::extPath('lang') . 'locallang_csh_corebe.xlf', 'tcatree');
index 84ed661..7fc64f0 100644 (file)
@@ -22,15 +22,12 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Html\HtmlParser;
 use TYPO3\CMS\Core\Http\AjaxRequestHandler;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Lang\LanguageService;
-use TYPO3\CMS\Backend\Form\Container\FullRecordContainer;
-use TYPO3\CMS\Backend\Form\Container\SoloFieldContainer;
-use TYPO3\CMS\Backend\Form\Container\InlineRecordContainer;
-use TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer;
-use TYPO3\CMS\Core\Utility\ArrayUtility;
 
 /**
  * This is form engine - Class for creating the backend editing forms.
@@ -214,6 +211,11 @@ class FormEngine {
        protected $requireJsModules = array();
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Constructor function, setting internal variables, loading the styles used.
         *
         */
@@ -1055,8 +1057,8 @@ class FormEngine {
         * @todo: aaaargs ...
         */
        protected function getJavaScriptOfPageRenderer() {
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = clone $GLOBALS['SOBE']->doc->getPageRenderer();
+               /** @var $pageRenderer PageRenderer */
+               $pageRenderer = clone $this->getPageRenderer();
                $pageRenderer->setCharSet($this->getLanguageService()->charSet);
                $pageRenderer->setTemplateFile('EXT:backend/Resources/Private/Templates/helper_javascript_css.html');
                return $pageRenderer->render();
@@ -1220,7 +1222,6 @@ class FormEngine {
                        if ($this->loadMD5_JS) {
                                $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
                        }
-                       $pageRenderer = $this->getPageRenderer();
                        // load the main module for FormEngine with all important JS functions
                        $this->requireJsModules['TYPO3/CMS/Backend/FormEngine'] = 'function(FormEngine) {
                                FormEngine.setBrowserUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('browser')) . ');
@@ -1235,26 +1236,26 @@ class FormEngine {
                                        $callbacks = array($callbacks);
                                }
                                foreach ($callbacks as $callback) {
-                                       $pageRenderer->loadRequireJsModule($moduleName, $callback);
+                                       $this->getPageRenderer()->loadRequireJsModule($moduleName, $callback);
                                }
                        }
-                       $pageRenderer->loadPrototype();
-                       $pageRenderer->loadJquery();
-                       $pageRenderer->loadExtJS();
+                       $this->getPageRenderer()->loadPrototype();
+                       $this->getPageRenderer()->loadJquery();
+                       $this->getPageRenderer()->loadExtJS();
                        // rtehtmlarea needs extjs quick tips (?)
-                       $pageRenderer->enableExtJSQuickTips();
+                       $this->getPageRenderer()->enableExtJSQuickTips();
                        $beUserAuth = $this->getBackendUserAuthentication();
                        // Make textareas resizable and flexible ("autogrow" in height)
                        $textareaSettings = array(
                                'autosize'  => (bool)$beUserAuth->uc['resizeTextareas_Flexible']
                        );
-                       $pageRenderer->addInlineSettingArray('Textarea', $textareaSettings);
+                       $this->getPageRenderer()->addInlineSettingArray('Textarea', $textareaSettings);
 
                        $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
-                       $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ValueSlider');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ValueSlider');
                        // Needed for FormEngine manipulation (date picker)
                        $dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY'));
-                       $pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
+                       $this->getPageRenderer()->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
 
                        // support placeholders for IE9 and lower
                        $clientInfo = GeneralUtility::clientInfo();
@@ -1263,13 +1264,13 @@ class FormEngine {
                        }
 
                        // @todo: remove scriptaclous once suggest & flex form foo is moved to RequireJS, see #55575
-                       $pageRenderer->loadScriptaculous();
+                       $this->getPageRenderer()->loadScriptaculous();
                        $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
 
-                       $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
-                       $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
 
-                       $pageRenderer->addInlineLanguagelabelFile(
+                       $this->getPageRenderer()->addInlineLanguagelabelFile(
                                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lang') . 'locallang_core.xlf',
                                'file_upload'
                        );
@@ -1327,15 +1328,12 @@ class FormEngine {
         * @return string
         */
        public function printNeededJSFunctions() {
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->getControllerDocumentTemplate()->getPageRenderer();
-
                // set variables to be accessible for JS
-               $pageRenderer->addInlineSetting('FormEngine', 'formName', 'editform');
-               $pageRenderer->addInlineSetting('FormEngine', 'backPath', '');
+               $this->getPageRenderer()->addInlineSetting('FormEngine', 'formName', 'editform');
+               $this->getPageRenderer()->addInlineSetting('FormEngine', 'backPath', '');
 
                // Integrate JS functions for the element browser if such fields or IRRE fields were processed
-               $pageRenderer->addInlineSetting('FormEngine', 'legacyFieldChangedCb', 'function() { ' . $this->TBE_EDITOR_fieldChanged_func . ' };');
+               $this->getPageRenderer()->addInlineSetting('FormEngine', 'legacyFieldChangedCb', 'function() { ' . $this->TBE_EDITOR_fieldChanged_func . ' };');
 
                return $this->JSbottom('editform');
        }
@@ -1467,7 +1465,11 @@ class FormEngine {
         * @return \TYPO3\CMS\Core\Page\PageRenderer
         */
        protected function getPageRenderer() {
-               return $this->getControllerDocumentTemplate()->getPageRenderer();
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
        }
 
 }
index b85bbe4..baf2419 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
@@ -157,6 +158,11 @@ abstract class AbstractFunctionModule {
        public $function_key = '';
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Initialize the object
         *
         * @param BaseScriptClass $pObj A reference to the parent (calling) object
@@ -287,4 +293,15 @@ abstract class AbstractFunctionModule {
                return $GLOBALS['TYPO3_DB'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index ae85902..a188c19 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
 
@@ -190,6 +191,11 @@ class BaseScriptClass {
        public $extObj;
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Initializes the backend module by setting internal variables, initializing the menu.
         *
         * @return void
@@ -365,4 +371,15 @@ class BaseScriptClass {
                return $GLOBALS['TYPO3_DB'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index bb943bd..1858b96 100644 (file)
@@ -352,7 +352,7 @@ function jumpToUrl(URL) {
        public $hasDocheader = TRUE;
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        * @var PageRenderer
         */
        protected $pageRenderer;
 
@@ -436,11 +436,12 @@ function jumpToUrl(URL) {
        /**
         * Gets instance of PageRenderer configured with the current language, file references and debug settings
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. This method will become protected then.
         */
        public function getPageRenderer() {
                if (!isset($this->pageRenderer)) {
-                       $this->pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                        $this->pageRenderer->setLanguage($GLOBALS['LANG']->lang);
                        $this->pageRenderer->enableConcatenateFiles();
                        $this->pageRenderer->enableCompressCss();
@@ -1579,7 +1580,7 @@ function jumpToUrl(URL) {
         * @return string
         */
        public function getDynamicTabMenu(array $menuItems, $identString, $defaultTabIndex = 1, $collapseable = FALSE, $wrapContent = TRUE, $storeLastActiveTab = TRUE) {
-               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tabs');
+               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tabs');
                $templatePathAndFileName = 'EXT:backend/Resources/Private/Templates/DocumentTemplate/' . ($collapseable ? 'Collapse.html' : 'Tabs.html');
                $view = GeneralUtility::makeInstance(StandaloneView::class);
                $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templatePathAndFileName));
index f5ad348..5a7ed5a 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Template;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Extension class for "template" - used in the context of frontend editing.
  */
@@ -22,11 +25,13 @@ class FrontendDocumentTemplate extends DocumentTemplate {
        /**
         * Gets instance of PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function getPageRenderer() {
+               GeneralUtility::logDeprecatedFunction();
                if (!isset($this->pageRenderer)) {
-                       $this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                }
                return $this->pageRenderer;
        }
index 930eb16..69f30f7 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Versioning\VersionState;
@@ -374,8 +375,8 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                $this->initializeLanguages();
                $this->initializeClipboard();
                $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), TRUE));
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->getPageLayoutController()->doc->getPageRenderer();
+               /** @var $pageRenderer PageRenderer */
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
                $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop');
                $userCanEditPage = $this->ext_CALC_PERMS & Permission::PAGE_EDIT && !empty($this->id);
                if ($this->tt_contentConfig['languageColsPointer'] > 0) {
index 82eae43..92bd798 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Belog\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
+
 /**
  * Abstract class to show log entries from sys_log
  *
@@ -77,7 +79,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
        protected $logEntryRepository = NULL;
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        * @var PageRenderer
         */
        protected $pageRenderer;
 
@@ -86,7 +88,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
         * @return void
         */
        public function initializeAction() {
-               $this->pageRenderer = $this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class);
+               $this->pageRenderer = $this->objectManager->get(PageRenderer::class);
                $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker');
        }
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68074-DeprecateGetPageRenderer.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68074-DeprecateGetPageRenderer.rst
new file mode 100644 (file)
index 0000000..b215cd3
--- /dev/null
@@ -0,0 +1,28 @@
+=========================================================
+Deprecation: #68074 - Deprecate getPageRenderer() methods
+=========================================================
+
+Description
+===========
+
+The following public functions have been marked for deprecation as the instance they return is a singleton:
+
+* TYPO3\CMS\Backend\Controller\BackendController::getPageRenderer()
+* TYPO3\CMS\Backend\Template\DocumentTemplate::getPageRenderer()
+* TYPO3\CMS\Backend\Template\FrontendDocumentTemplate::getPageRenderer()
+* TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getPageRenderer()
+
+
+Impact
+======
+
+Using ``BackendController::getPageRenderer`` or ``FrontendDocumentTemplate::getPageRenderer`` will throw a deprecation message.
+The public functions ``DocumentTemplate::getPageRenderer`` and ``TypoScriptFrontendController::getPageRenderer`` will become
+protected methods with TYPO3 CMS 8. As those functions have to be used within the classes themselves no deprecation message can be thrown.
+
+
+Migration
+=========
+
+As the PageRenderer implements a SingletonInterface you can get your own (shared) instance with
+\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class) and work with that one.
index 0ba317c..48406f3 100644 (file)
@@ -14,8 +14,8 @@ namespace TYPO3\CMS\Extbase\Mvc\Web;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 
 /**
@@ -238,15 +238,8 @@ class Response extends \TYPO3\CMS\Extbase\Mvc\Response {
                }
                if ($this->request->isCached()) {
                        /** @var PageRenderer $pageRenderer */
-                       $pageRenderer = NULL;
-                       if ($this->environmentService->isEnvironmentInFrontendMode()) {
-                               $pageRenderer = $this->getTypoScriptFrontendController()->getPageRenderer();
-                       } elseif ($this->environmentService->isEnvironmentInBackendMode()) {
-                               $pageRenderer = $this->getDocumentTemplate()->getPageRenderer();
-                       }
-                       if ($pageRenderer !== NULL) {
-                               $pageRenderer->addHeaderData($additionalHeaderData);
-                       }
+                       $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+                       $pageRenderer->addHeaderData($additionalHeaderData);
                } else {
                        $this->additionalHeaderData[] = $additionalHeaderData;
                }
@@ -296,11 +289,4 @@ class Response extends \TYPO3\CMS\Extbase\Mvc\Response {
                return $GLOBALS['TSFE'];
        }
 
-       /**
-        * @return DocumentTemplate
-        */
-       protected function getDocumentTemplate() {
-               return $GLOBALS['TBE_TEMPLATE'];
-       }
-
 }
\ No newline at end of file
index 145e502..ec06c9d 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extensionmanager\ViewHelpers\Be;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Extensionmanager\Controller\AbstractController;
 
 /**
@@ -43,8 +44,7 @@ class TriggerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendV
         * @see \TYPO3\CMS\Core\Page\PageRenderer
         */
        public function render($triggers = array()) {
-               $doc = $this->getDocInstance();
-               $pageRenderer = $doc->getPageRenderer();
+               $pageRenderer = $this->getPageRenderer();
                // Handle triggers
                if (!empty($triggers[AbstractController::TRIGGER_RefreshModuleMenu])) {
                        $pageRenderer->addJsInlineCode(
@@ -55,4 +55,11 @@ class TriggerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendV
                return '';
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return $this->objectManager->get(PageRenderer::class);
+       }
+
 }
index c7bace2..56ceaa0 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Resource\Utility\ListUtility;
@@ -269,8 +270,7 @@ class FileListController {
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:filelist/Resources/Private/Templates/file_list.html');
 
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $this->doc->getPageRenderer();
+               $pageRenderer = $this->getPageRenderer();
                $pageRenderer->loadJQuery();
                $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
 
@@ -540,4 +540,11 @@ class FileListController {
                return $GLOBALS['BE_USER'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }
index 6fba7ef..ced5645 100644 (file)
@@ -22,6 +22,7 @@ namespace TYPO3\CMS\Fluid\ViewHelpers\Be;
  *                                                                        */
 
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
 
@@ -50,4 +51,21 @@ abstract class AbstractBackendViewHelper extends AbstractViewHelper {
                return $doc;
        }
 
+       /**
+        * Gets instance of PageRenderer if exists or create a new one.
+        * Saves instance in viewHelperVariableContainer
+        *
+        * @return PageRenderer
+        */
+       public function getPageRenderer() {
+               if ($this->viewHelperVariableContainer->exists(AbstractBackendViewHelper::class, 'PageRenderer')) {
+                       $pageRenderer = $this->viewHelperVariableContainer->get(AbstractBackendViewHelper::class, 'PageRenderer');
+               } else {
+                       /** @var $doc DocumentTemplate */
+                       $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+                       $this->viewHelperVariableContainer->add(AbstractBackendViewHelper::class, 'PageRenderer', $pageRenderer);
+               }
+
+               return $pageRenderer;
+       }
 }
index 2079e9e..bd550ba 100644 (file)
@@ -71,8 +71,8 @@ class ContainerViewHelper extends AbstractBackendViewHelper {
         * @see \TYPO3\CMS\Core\Page\PageRenderer
         */
        public function render($pageTitle = '', $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $enableExtJsDebug = FALSE, $loadJQuery = FALSE, $includeCssFiles = NULL, $includeJsFiles = NULL, $addJsInlineLabels = NULL, $includeCsh = TRUE, $includeRequireJsModules = NULL) {
+               $pageRenderer = $this->getPageRenderer();
                $doc = $this->getDocInstance();
-               $pageRenderer = $doc->getPageRenderer();
                $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
 
                // Load various standard libraries
index 2b66204..8a3e7e1 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Form\View\Wizard;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -36,7 +37,7 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
        public $doc;
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        * @var PageRenderer
         */
        protected $pageRenderer;
 
@@ -59,10 +60,9 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:form/Resources/Private/Templates/Wizard.html');
-               $this->pageRenderer = $this->doc->getPageRenderer();
-               $this->pageRenderer->enableConcatenateFiles();
-               $this->pageRenderer->enableCompressCss();
-               $this->pageRenderer->enableCompressJavascript();
+               $this->getPageRenderer()->enableConcatenateFiles();
+               $this->getPageRenderer()->enableCompressCss();
+               $this->getPageRenderer()->enableCompressJavascript();
        }
 
        /**
@@ -355,4 +355,15 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                return $bodyContent;
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if (!isset($this->pageRenderer)) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index c21bb84..bbb1fbc 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Frontend\ContentObject;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Contains an abstract class for all tslib content class implementations.
  *
@@ -28,6 +31,11 @@ abstract class AbstractContentObject {
        protected $cObj;
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Default constructor.
         *
         * @param ContentObjectRenderer $cObj
@@ -53,4 +61,15 @@ abstract class AbstractContentObject {
                return $this->cObj;
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index f7ca37b..dfbca23 100644 (file)
@@ -978,6 +978,7 @@ class TypoScriptFrontendController {
         * Gets instance of PageRenderer
         *
         * @return PageRenderer
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. This method will become protected then.
         */
        public function getPageRenderer() {
                if (!isset($this->pageRenderer)) {
index 7ccb46b..05f6351 100644 (file)
@@ -157,12 +157,12 @@ class PageGenerator {
                                        $tsfe->xhtmlVersion = 200;
                                        break;
                                default:
-                                       $tsfe->getPageRenderer()->setRenderXhtml(FALSE);
+                                       static::getPageRenderer()->setRenderXhtml(FALSE);
                                        $tsfe->xhtmlDoctype = '';
                                        $tsfe->xhtmlVersion = 0;
                        }
                } else {
-                       $tsfe->getPageRenderer()->setRenderXhtml(FALSE);
+                       static::getPageRenderer()->setRenderXhtml(FALSE);
                }
        }
 
@@ -236,7 +236,7 @@ class PageGenerator {
                /** @var TimeTracker $timeTracker */
                $timeTracker = $GLOBALS['TT'];
 
-               $pageRenderer = $tsfe->getPageRenderer();
+               $pageRenderer = static::getPageRenderer();
                if ($tsfe->config['config']['moveJsFromHeaderToFooter']) {
                        $pageRenderer->enableMoveJsFromHeaderToFooter();
                }
@@ -1125,7 +1125,7 @@ class PageGenerator {
                        $titleTagContent = $tsfe->cObj->stdWrap($titleTagContent, $tsfe->config['config']['pageTitle.']);
                }
                if ($titleTagContent !== '' && (int)$tsfe->config['config']['noPageTitle'] !== self::NO_PAGE_TITLE) {
-                       $tsfe->getPageRenderer()->setTitle($titleTagContent);
+                       static::getPageRenderer()->setTitle($titleTagContent);
                }
        }
 
@@ -1202,4 +1202,11 @@ class PageGenerator {
                        $tsfe->sWordRegEx = rtrim($tsfe->sWordRegEx, '|');
                }
        }
+
+       /**
+        * @return PageRenderer
+        */
+       static protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
 }
index a0cde94..c2f57a7 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Impexp\Hook;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * This class adds import export related JavaScript to the backend
@@ -28,7 +30,14 @@ class BackendControllerHook {
         * @return void
         */
        public function addJavaScript(array $configuration, \TYPO3\CMS\Backend\Controller\BackendController $backendController) {
-               $backendController->getPageRenderer()->addInlineSetting('ImportExport', 'moduleUrl', BackendUtility::getModuleUrl('xMOD_tximpexp'));
+               $this->getPageRenderer()->addInlineSetting('ImportExport', 'moduleUrl', BackendUtility::getModuleUrl('xMOD_tximpexp'));
+       }
+
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
 }
index f51f372..685f406 100644 (file)
@@ -62,7 +62,7 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
         */
        public function render($pageTitle = '', $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $enableExtJsDebug = FALSE, $addCssFiles = array(), $addJsFiles = array(), $triggers = array()) {
                $doc = $this->getDocInstance();
-               $pageRenderer = $doc->getPageRenderer();
+               $pageRenderer = $this->getPageRenderer();
 
                $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
                if ($enableClickMenu) {
index befada8..65e6eef 100644 (file)
@@ -168,7 +168,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                $this->initialize();
 
                // Localization
-               $this->doc->getPageRenderer()->addInlineLanguageLabelFile(
+               $this->getPageRenderer()->addInlineLanguageLabelFile(
                        ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')
                );
 
@@ -238,8 +238,8 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                }
 
                $this->doc->addStyleSheet('module', 'sysext/linkvalidator/Resources/Public/Styles/styles.css');
-               $this->doc->getPageRenderer()->loadJquery();
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Linkvalidator/Linkvalidator');
+               $this->getPageRenderer()->loadJquery();
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Linkvalidator/Linkvalidator');
 
                // Don't access in workspace
                if ($this->getBackendUser()->workspace !== 0) {
index 6342ecf..d60a954 100644 (file)
@@ -306,7 +306,7 @@ class DatabaseIntegrityView extends BaseScriptClass {
                $this->view->assign('searchMode', $searchMode);
                switch ($searchMode) {
                        case 'query':
-                               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Core/QueryGenerator');
+                               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Core/QueryGenerator');
                                $this->view->assign('queryMaker', $fullsearch->queryMaker());
                                break;
                        case 'raw':
index c4a1a5f..59ec55a 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Mediace\ContentObject;
  */
 
 use TYPO3\CMS\Core\Utility\ArrayUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Contains FlowPlayer class object.
@@ -207,8 +208,6 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
         * @return string Output
         */
        public function render($conf = array()) {
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
                $params = ($prefix = '');
                if ($GLOBALS['TSFE']->baseUrl) {
                        $prefix = $GLOBALS['TSFE']->baseUrl;
@@ -224,16 +223,16 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
                $typeConf = $conf[$type . '.'];
                // Add Flowplayer js-file
-               $pageRenderer->addJsFile($this->getPathToLibrary('flowplayer/flowplayer-3.2.13.min.js'));
+               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('flowplayer/flowplayer-3.2.13.min.js'));
                // Add Flowpayer css for exprss install
-               $pageRenderer->addCssFile($this->getPathToLibrary('flowplayer/express-install/express-install.css'));
+               $this->getPageRenderer()->addCssFile($this->getPathToLibrary('flowplayer/express-install/express-install.css'));
                // Add videoJS js-file
-               $pageRenderer->addJsFile($this->getPathToLibrary('videojs/video-js/video.js'));
+               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('videojs/video-js/video.js'));
                // Add videoJS css-file
-               $pageRenderer->addCssFile($this->getPathToLibrary('videojs/video-js/video-js.css'));
+               $this->getPageRenderer()->addCssFile($this->getPathToLibrary('videojs/video-js/video-js.css'));
                // Add extended videoJS control bar
-               $pageRenderer->addJsFile($this->getPathToLibrary('videojs/video-js/controls/control-bar.js'));
-               $pageRenderer->addCssFile($this->getPathToLibrary('videojs/video-js/controls/control-bar.css'));
+               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('videojs/video-js/controls/control-bar.js'));
+               $this->getPageRenderer()->addCssFile($this->getPathToLibrary('videojs/video-js/controls/control-bar.css'));
                // Build Flash configuration
                $player = isset($typeConf['player.']) ? $this->cObj->stdWrap($typeConf['player'], $typeConf['player.']) : $typeConf['player'];
                if (!$player) {
@@ -315,7 +314,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                // Hook for manipulating the conf array, it's needed for some players like flowplayer
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['swfParamTransform'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['swfParamTransform'] as $classRef) {
-                               \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($classRef, $conf, $this);
+                               GeneralUtility::callUserFunction($classRef, $conf, $this);
                        }
                }
                // Flowplayer config
@@ -333,7 +332,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                $videoSources = '';
                if (is_array($conf['sources'])) {
                        foreach ($conf['sources'] as $source) {
-                               $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                               $fileinfo = GeneralUtility::split_fileref($source);
                                $mimeType = $this->mimeTypes[$fileinfo['fileext']]['video'];
                                $videoSources .= '<source src="' . $source . '"' . ($mimeType ? ' type="' . $mimeType . '"' : '') . ' />' . LF;
                        }
@@ -342,7 +341,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                $audioSources = '';
                if (is_array($conf['audioSources'])) {
                        foreach ($conf['audioSources'] as $source) {
-                               $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                               $fileinfo = GeneralUtility::split_fileref($source);
                                $mimeType = $this->mimeTypes[$fileinfo['fileext']]['audio'];
                                $audioSources .= '<source src="' . $source . '"' . ($mimeType ? ' type="' . $mimeType . '"' : '') . ' />' . LF;
                        }
@@ -352,7 +351,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                        // Assemble captions track tag
                        $videoCaptions = '<track id="' . $replaceElementIdString . '_captions_track" kind="captions" src="' . $conf['caption'] . '" default>' . LF;
                        // Add videoJS extension for captions
-                       $pageRenderer->addJsFile($this->getPathToLibrary('videojs/video-js/controls/captions.js'));
+                       $this->getPageRenderer()->addJsFile($this->getPathToLibrary('videojs/video-js/controls/captions.js'));
                        // Flowplayer captions
                        $conf['videoflashvars']['captionUrl'] = $conf['caption'];
                        // Flowplayer captions plugin configuration
@@ -366,7 +365,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                if ($conf['type'] == 'video') {
                        if (is_array($conf['audioSources']) && !empty($conf['audioSources'])) {
                                // Add videoJS audio description toggle
-                               $pageRenderer->addJsFile($this->getPathToLibrary('videojs/video-js/controls/audio-description.js'));
+                               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('videojs/video-js/controls/audio-description.js'));
                        }
                        if (isset($conf['audioFallback'])) {
                                // Audio description flowplayer config (remove controls)
@@ -504,7 +503,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                                        // Create "source" elements
                                        if (is_array($conf['sources']) && !empty($conf['sources'])) {
                                                foreach ($conf['sources'] as $source) {
-                                                       $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                                                       $fileinfo = GeneralUtility::split_fileref($source);
                                                        $mimeType = $this->mimeTypes[$fileinfo['fileext']]['video'];
                                                        $videoTagAssembly .= '
                        ' . $replaceElementIdString . '_video_js.appendChild($f.extend(document.createElement("source"), {
@@ -557,7 +556,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                                        // Test whether the browser supports any of types of the provided sources
                                        $supported = array();
                                        foreach ($conf['sources'] as $source) {
-                                               $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                                               $fileinfo = GeneralUtility::split_fileref($source);
                                                $mimeType = $this->mimeTypes[$fileinfo['fileext']]['video'];
                                                $supported[] = $replaceElementIdString . '_videoTag.canPlayType("' . $mimeType . '") != ""';
                                        }
@@ -596,7 +595,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                                // Create "source" elements
                                if (is_array($conf['audioSources']) && !empty($conf['audioSources'])) {
                                        foreach ($conf['audioSources'] as $source) {
-                                               $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                                               $fileinfo = GeneralUtility::split_fileref($source);
                                                $mimeType = $this->mimeTypes[$fileinfo['fileext']]['audio'];
                                                $audioTagAssembly .= '
                ' . $replaceElementIdString . '_audio_element.appendChild($f.extend(document.createElement("source"), {
@@ -637,7 +636,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                                // Test whether the browser supports any of types of the provided sources
                                $supported = array();
                                foreach ($conf['audioSources'] as $source) {
-                                       $fileinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($source);
+                                       $fileinfo = GeneralUtility::split_fileref($source);
                                        $mimeType = $this->mimeTypes[$fileinfo['fileext']]['audio'];
                                        $supported[] = $replaceElementIdString . '_audioTag.canPlayType("' . $mimeType . '") != ""';
                                }
@@ -714,7 +713,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                if ($jsInlineCode) {
                        $jsInlineCode = 'VideoJS.DOMReady(function(){' . $jsInlineCode . LF . '});';
                }
-               $pageRenderer->addJsInlineCode($replaceElementIdString, $jsInlineCode);
+               $this->getPageRenderer()->addJsInlineCode($replaceElementIdString, $jsInlineCode);
                if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
index 4570205..63eb698 100644 (file)
@@ -51,7 +51,7 @@ class QuicktimeObjectContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abs
 
                $typeConf = $conf[$type . '.'];
                // Add QTobject js-file
-               $GLOBALS['TSFE']->getPageRenderer()->addJsFile($this->getPathToLibrary('flashmedia/qtobject/qtobject.js'));
+               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('flashmedia/qtobject/qtobject.js'));
                $replaceElementIdString = str_replace('.', '', uniqid('mmqt', TRUE));
                $GLOBALS['TSFE']->register['MMQTID'] = $replaceElementIdString;
                $qtObject = 'QTObject' . $replaceElementIdString;
index 0e97f53..ab929d1 100644 (file)
@@ -40,11 +40,9 @@ class ShockwaveFlashObjectContentObject extends \TYPO3\CMS\Frontend\ContentObjec
                }
                $type = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
                $typeConf = $conf[$type . '.'];
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
-               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
 
                // Add SWFobject js-file
-               $pageRenderer->addJsFile($this->getPathToLibrary('flashmedia/swfobject/swfobject.js'));
+               $this->getPageRenderer()->addJsFile($this->getPathToLibrary('flashmedia/swfobject/swfobject.js'));
                $player = isset($typeConf['player.']) ? $this->cObj->stdWrap($typeConf['player'], $typeConf['player.']) : $typeConf['player'];
                if (strpos($player, 'EXT:') === 0) {
                        $player = $prefix . $GLOBALS['TSFE']->tmpl->getFileName($player);
@@ -122,7 +120,7 @@ class ShockwaveFlashObjectContentObject extends \TYPO3\CMS\Frontend\ContentObjec
                $embed = 'swfobject.embedSWF("' . $conf['player'] . '", "' . $replaceElementIdString . '", "' . $width . '", "' . $height . '",
                                "' . $flashVersion . '", "' . $installUrl . '", ' . $conf['embedParams'] . ');';
                $script = $flashvars . $params . $attributes . $embed;
-               $pageRenderer->addJsInlineCode($replaceElementIdString, $script);
+               $this->getPageRenderer()->addJsInlineCode($replaceElementIdString, $script);
                if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
index 36f7162..7991698 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Opendocs\Backend\ToolbarItems;
 
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -262,12 +263,10 @@ class OpendocsToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
        /**
index 150dfb0..93235fb 100644 (file)
@@ -17,10 +17,13 @@ namespace TYPO3\CMS\Recordlist\Browser;
 use TYPO3\CMS\Backend\Form\FormEngine;
 use TYPO3\CMS\Backend\RecordList\ElementBrowserRecordList;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\ElementBrowser\ElementBrowserHookInterface;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\Resource\FileInterface;
@@ -32,8 +35,6 @@ use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\File\BasicFileUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\StringUtility;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Frontend\Service\TypoLinkCodecService;
 use TYPO3\CMS\Lang\LanguageService;
@@ -249,6 +250,11 @@ class ElementBrowser {
        public $fileProcessor;
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Sets the script url depending on being a module or script request
         */
        protected function determineScriptUrl() {
@@ -363,8 +369,8 @@ class ElementBrowser {
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->bodyTagId = 'typo3-browse-links-php';
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/BrowseLinks');
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/BrowseLinks');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree');
        }
 
        /**
@@ -2617,4 +2623,15 @@ class ElementBrowser {
                return $GLOBALS['TYPO3_DB'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index 4806294..d3ee0ae 100644 (file)
@@ -35,6 +35,11 @@ class ElementBrowserFramesetController {
        public $content;
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Main function.
         * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames.
         *
@@ -67,7 +72,7 @@ class ElementBrowserFramesetController {
 
                // Create the frameset for the window
                // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
-               $this->content = $documentTemplate->getPageRenderer()->render(PageRenderer::PART_HEADER) .
+               $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) .
                        '<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
                                <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
                                <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
@@ -99,4 +104,15 @@ class ElementBrowserFramesetController {
                return $GLOBALS['LANG'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
+       }
+
 }
index 61beb5d..84a4ba9 100644 (file)
@@ -16,14 +16,15 @@ namespace TYPO3\CMS\Recordlist;
 
 use TYPO3\CMS\Backend\Clipboard\Clipboard;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Extbase\Service\TypoScriptService;
 use TYPO3\CMS\Lang\LanguageService;
@@ -182,6 +183,11 @@ class RecordList {
        public $body = '';
 
        /**
+        * @var PageRenderer
+        */
+       protected $pageRenderer = NULL;
+
+       /**
         * Constructor
         */
        public function __construct() {
@@ -216,7 +222,7 @@ class RecordList {
                $this->menuConfig();
                // Store session data
                $backendUser->setAndSaveSessionData(RecordList::class, $sessionData);
-               $this->getDocumentTemplate()->getPageRenderer()->addInlineLanguageLabelFile('EXT:lang/locallang_mod_web_list.xlf');
+               $this->getPageRenderer()->addInlineLanguageLabelFile('EXT:lang/locallang_mod_web_list.xlf');
        }
 
        /**
@@ -266,14 +272,14 @@ class RecordList {
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:recordlist/Resources/Private/Templates/db_list.html');
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler');
                $calcPerms = $backendUser->calcPerms($this->pageinfo);
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
                        PageActions.setPageId(' . (int)$this->id . ');
                        PageActions.setCanEditPage(' . ($calcPerms & Permission::PAGE_EDIT && !empty($this->id) ? 'true' : 'false') . ');
                        PageActions.initializePageTitleRenaming();
                }');
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Recordlist/Tooltip');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Recordlist/Tooltip');
                // Apply predefined values for hidden checkboxes
                // Set predefined value for DisplayBigControlPanel:
                if ($this->modTSconfig['properties']['enableDisplayBigControlPanel'] === 'activated') {
@@ -568,10 +574,14 @@ class RecordList {
        }
 
        /**
-        * @return DocumentTemplate
+        * @return PageRenderer
         */
-       protected function getDocumentTemplate() {
-               return $GLOBALS['TBE_TEMPLATE'];
+       protected function getPageRenderer() {
+               if ($this->pageRenderer === NULL) {
+                       $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               }
+
+               return $this->pageRenderer;
        }
 
 }
index f8bd3e8..0dd6abb 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Recycler\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -176,11 +177,9 @@ class RecyclerModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 }
index 05dda5c..fcf138a 100644 (file)
@@ -135,10 +135,10 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                $this->doc->getContextMenuCode();
                // Apply the same styles as those of the base script
                $this->doc->bodyTagId = 'typo3-browse-links-php';
-               $this->doc->getPageRenderer()->addCssFile($this->doc->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3skin') . 'rtehtmlarea/htmlarea.css');
+               $this->getPageRenderer()->addCssFile($this->doc->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3skin') . 'rtehtmlarea/htmlarea.css');
                // Add attributes to body tag. Note: getBodyTagAdditions will invoke the hooks
                $this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function(Tree) {
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function(Tree) {
                        Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
                }');
        }
index 5b54257..effe47e 100644 (file)
@@ -1357,7 +1357,7 @@ class RichTextElement extends AbstractFormElement {
         * @return PageRenderer
         */
        protected function getPageRenderer() {
-               return $GLOBALS['SOBE']->doc->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
 }
index 3c30830..724db85 100644 (file)
@@ -132,17 +132,17 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
 
                $this->doc->bodyTagId = 'typo3-browse-links-php';
                $this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function(Tree) {
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree', 'function(Tree) {
                        Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
                }');
-               $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Rtehtmlarea/Modules/SelectImage', 'function(SelectImage) {
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Rtehtmlarea/Modules/SelectImage', 'function(SelectImage) {
                        SelectImage.editorNo = ' . GeneralUtility::quoteJSvalue($this->editorNo) . ';
                        SelectImage.act = ' . GeneralUtility::quoteJSvalue(($this->act ?: reset($this->allowedItems))) . ';
                        SelectImage.sys_language_content = ' . GeneralUtility::quoteJSvalue($this->sys_language_content) . ';
                        SelectImage.RTEtsConfigParams = ' . GeneralUtility::quoteJSvalue(rawurlencode($this->RTEtsConfigParams)) . ';
                        SelectImage.bparams = ' . GeneralUtility::quoteJSvalue($this->bparams) . ';
                }');
-               $this->doc->getPageRenderer()->addCssFile($this->doc->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3skin') . 'rtehtmlarea/htmlarea.css');
+               $this->getPageRenderer()->addCssFile($this->doc->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3skin') . 'rtehtmlarea/htmlarea.css');
                $this->doc->getContextMenuCode();
        }
 
index 3b1bb4f..739325f 100644 (file)
@@ -14,14 +14,15 @@ namespace TYPO3\CMS\Scheduler\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Backend\Utility\IconUtility;
-use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
 use TYPO3\CMS\Saltedpasswords\Salt\SaltFactory;
 use TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility;
@@ -69,11 +70,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
        protected $scheduler;
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
-        */
-       protected $pageRenderer;
-
-       /**
         * @var string
         */
        protected $backendTemplatePath = '';
@@ -126,8 +122,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                $this->doc->bodyTagId = 'typo3-mod-php';
                $this->doc->bodyTagAdditions = 'class="tx_scheduler_mod1"';
 
-               $this->pageRenderer = $this->doc->getPageRenderer();
-
                // Create scheduler instance
                $this->scheduler = GeneralUtility::makeInstance(\TYPO3\CMS\Scheduler\Scheduler::class);
        }
@@ -647,9 +641,9 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                }
 
                // Load necessary JavaScript
-               $this->pageRenderer->loadJquery();
-               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
-               $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker');
+               $this->getPageRenderer()->loadJquery();
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
+               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker');
 
                // Start rendering the add/edit form
                $this->view->assign('uid', htmlspecialchars($this->submittedData['uid']));
@@ -921,8 +915,8 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                        $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'ListTasksNoTasks.html');
                        return $this->view->render();
                } else {
-                       $this->pageRenderer->loadJquery();
-                       $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
+                       $this->getPageRenderer()->loadJquery();
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Scheduler/Scheduler');
                        $table = array();
                        // Header row
                        $table[] =
index 0222872..fff98bc 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\T3editor\Hook;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -71,7 +72,7 @@ class FileEditHook {
                if (GeneralUtility::_GET('M') === 'file_edit') {
                        $t3editor = $this->getT3editor();
                        $documentTemplate->JScode .= $t3editor->getJavascriptCode($documentTemplate);
-                       $documentTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/T3editor/FileEdit');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/T3editor/FileEdit');
                }
        }
 
@@ -112,4 +113,11 @@ class FileEditHook {
                return $savingsuccess;
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }
index ce78c7a..6719686 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\T3editor;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -163,8 +165,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface {
                $path_t3e = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('t3editor');
                $path_codemirror = 'contrib/codemirror/js/';
                // Include needed javascript-frameworks
-               $pageRenderer = $doc->getPageRenderer();
-               /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
+               $pageRenderer = $this->getPageRenderer();
                $pageRenderer->loadPrototype();
                $pageRenderer->loadScriptaculous();
                // Include editor-css
@@ -381,4 +382,11 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface {
                $ajaxObj->setContentFormat('jsonbody');
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }
index 6ad6ab8..463609f 100644 (file)
@@ -53,7 +53,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
                $this->doc->setModuleTemplate(ExtensionManagementUtility::extPath('taskcenter') . 'Resources/Private/Templates/mod_template.html');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->doc->getPageRenderer()->loadJquery();
+               $this->getPageRenderer()->loadJquery();
                $this->doc->addStyleSheet('tx_taskcenter', '../' . ExtensionManagementUtility::siteRelPath('taskcenter') . 'Resources/Public/Styles/styles.css');
        }
 
@@ -218,7 +218,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $count = 0;
                // Change the sorting of items to the user's one
                if ($mainMenu) {
-                       $this->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Taskcenter/Taskcenter');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Taskcenter/Taskcenter');
                        $userSorting = unserialize($this->getBackendUser()->uc['taskcenter']['sorting']);
                        if (is_array($userSorting)) {
                                $newSorting = array();
index f05c70c..14ebb62 100644 (file)
@@ -124,7 +124,7 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
                        $tplRow = $this->getTemplateRow();
                        $theConstants = $this->getConstants();
 
-                       $this->pObj->doc->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Tstemplate/ConstantEditor');
+                       $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Tstemplate/ConstantEditor');
                        $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                        // Update template ?
                        if (GeneralUtility::_POST('submit') || MathUtility::canBeInterpretedAsInteger(GeneralUtility::_POST('submit_x')) && MathUtility::canBeInterpretedAsInteger(GeneralUtility::_POST('submit_y'))) {
index b2e17a4..574513d 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Viewpage\Controller;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Controller for viewing the frontend
@@ -31,7 +33,8 @@ class ViewModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
         */
        public function initializeAction() {
                $GLOBALS['LANG']->includeLLFile('EXT:viewpage/Resources/Private/Language/locallang.xlf');
-               $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->addInlineLanguageLabelFile('EXT:viewpage/Resources/Private/Language/locallang.xlf');
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               $pageRenderer->addInlineLanguageLabelFile('EXT:viewpage/Resources/Private/Language/locallang.xlf');
        }
 
        /**
@@ -50,12 +53,12 @@ class ViewModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
         * @return string
         */
        protected function getTargetUrl() {
-               $pageIdToShow = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
+               $pageIdToShow = (int)GeneralUtility::_GP('id');
                $adminCommand = $this->getAdminCommand($pageIdToShow);
                $domainName = $this->getDomainName($pageIdToShow);
                // Mount point overlay: Set new target page id and mp parameter
                /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */
-               $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
+               $sysPage = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
                $sysPage->init(FALSE);
                $mountPointMpParameter = '';
                $finalPageIdToShow = $pageIdToShow;
@@ -74,7 +77,7 @@ class ViewModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
                        } else {
                                $protocol = 'http';
                                $page = (array)$sysPage->getPage($finalPageIdToShow);
-                               if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
+                               if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && GeneralUtility::getIndpEnv('TYPO3_SSL')) {
                                        $protocol = 'https';
                                }
                                $protocolAndHost = $protocol . '://' . $domainName;
@@ -139,7 +142,7 @@ class ViewModuleController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionContr
         * @return array
         */
        protected function getPreviewFrameWidths() {
-               $pageId = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
+               $pageId = (int)GeneralUtility::_GP('id');
                $modTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.web_view');
                $widths = array(
                        '100%|100%' => $GLOBALS['LANG']->getLL('autoSize')
index 4f98278..82d38b5 100644 (file)
@@ -163,13 +163,11 @@ class CreatePagesWizardModuleFunctionController extends \TYPO3\CMS\Backend\Modul
                                                <input class="btn btn-default" type="reset" value="' . $this->getLanguageService()->getLL('wiz_newPages_lReset') . '" />
                                        </div>';
 
-                               /** @var \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer */
-                               $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
-                               $pageRenderer->loadJquery();
-                               $pageRenderer->loadRequireJsModule('TYPO3/CMS/WizardCrpages/WizardCreatePages');
+                               $this->getPageRenderer()->loadJquery();
+                               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/WizardCrpages/WizardCreatePages');
                                // Add inline code
                                $inlineJavaScriptCode = 'var tpl = "' . addslashes(str_replace(array(LF, TAB), array('', ''), $this->getFormLine('#'))) . '", i, line, div, bg, label;';
-                               $pageRenderer->addJsInlineCode('wizard_crpages', $inlineJavaScriptCode);
+                               $this->getPageRenderer()->addJsInlineCode('wizard_crpages', $inlineJavaScriptCode);
                        }
                } else {
                        $theCode .= GeneralUtility::makeInstance(FlashMessage::class, '', $this->getLanguageService()->getLL('wiz_newPages_errorMsg1'), FlashMessage::ERROR)->render();
index 64d7343..aaa6657 100644 (file)
@@ -14,10 +14,11 @@ namespace TYPO3\CMS\Workspaces\Backend\ToolbarItems;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
-use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Workspaces\Service\WorkspaceService;
 
 /**
  * Class to render the workspace selector
@@ -166,12 +167,10 @@ class WorkspaceSelectorToolbarItem implements ToolbarItemInterface {
        /**
         * Returns current PageRenderer
         *
-        * @return \TYPO3\CMS\Core\Page\PageRenderer
+        * @return PageRenderer
         */
        protected function getPageRenderer() {
-               /** @var  \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate */
-               $documentTemplate = $GLOBALS['TBE_TEMPLATE'];
-               return $documentTemplate->getPageRenderer();
+               return GeneralUtility::makeInstance(PageRenderer::class);
        }
 
        /**
index 4bd58e4..bea907a 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Workspaces\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Abstract action controller.
  *
@@ -27,7 +30,7 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
        protected $extensionName = 'Workspaces';
 
        /**
-        * @var \TYPO3\CMS\Core\Page\PageRenderer
+        * @var PageRenderer
         */
        protected $pageRenderer;
 
@@ -43,7 +46,7 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
         */
        protected function initializeAction() {
                // @todo Evaluate how the intval() call can be used with Extbase validators/filters
-               $this->pageId = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
+               $this->pageId = (int)GeneralUtility::_GP('id');
                $icons = array(
                        'language' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('flags-multiple'),
                        'integrity' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses('status-dialog-information'),
@@ -100,8 +103,8 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
         * @return void
         */
        public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
-               $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
-               $this->pageRenderer = $this->template->getPageRenderer();
+               $this->template = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
+               $this->pageRenderer = $this->getPageRenderer();
                $GLOBALS['SOBE'] = new \stdClass();
                $GLOBALS['SOBE']->doc = $this->template;
                parent::processRequest($request, $response);
@@ -145,4 +148,11 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
                return $GLOBALS['BE_USER'];
        }
 
+       /**
+        * @return PageRenderer
+        */
+       protected function getPageRenderer() {
+               return GeneralUtility::makeInstance(PageRenderer::class);
+       }
+
 }