[TASK] Remove usage of PageRenderer from ImageManipulationElement 75/42175/2
authorFrank Nägler <frank.naegler@typo3.org>
Fri, 31 Jul 2015 12:23:08 +0000 (14:23 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 31 Jul 2015 12:28:59 +0000 (14:28 +0200)
Resolves: #68674
Releases: master
Change-Id: I9821c54e785c67bbe140ff30c18a7369665f8bad
Reviewed-on: http://review.typo3.org/42175
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php

index 9ae3e67..115b8a1 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Form\Element;
 
 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;
@@ -52,6 +51,7 @@ class ImageManipulationElement extends AbstractFormElement {
         * @return array As defined in initializeResultArray() of AbstractNode
         */
        public function render() {
+               $resultArray = $this->initializeResultArray();
                $languageService = $this->getLanguageService();
 
                $row = $this->globalOptions['databaseRow'];
@@ -133,11 +133,8 @@ class ImageManipulationElement extends AbstractFormElement {
 
                        $content .= $this->getImageManipulationInfoTable($parameterArray['itemFormElValue']);
 
-                       /** @var $pageRenderer PageRenderer */
-                       $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
-                       $pageRenderer->loadRequireJsModule(
-                               'TYPO3/CMS/Backend/ImageManipulation',
-                               'function(ImageManipulation){ImageManipulation.initializeTrigger()}' // Initialize after load
+                       $resultArray['requireJsModules'][] = array(
+                               'TYPO3/CMS/Backend/ImageManipulation' => 'function(ImageManipulation){ImageManipulation.initializeTrigger()}'
                        );
                }
 
@@ -150,7 +147,6 @@ class ImageManipulationElement extends AbstractFormElement {
                $item .= '<div class="media-body">' . $content . '</div>';
                $item .= '</div>';
 
-               $resultArray = $this->initializeResultArray();
                $resultArray['html'] = $item;
                return $resultArray;
        }