[FEATURE] Allow EXT: syntax in PageRenderer and Compressor 91/49491/11
authorBenni Mack <benni@typo3.org>
Mon, 15 Aug 2016 21:44:02 +0000 (23:44 +0200)
committerBenni Mack <benni@typo3.org>
Tue, 30 Aug 2016 22:30:06 +0000 (00:30 +0200)
JS and CSS files can now be added via the EXT: syntax, to ease the
pain to a standardized way to include files with EXT: everywhere
now.

Resolves: #77589
Releases: master
Change-Id: Ie9de21cb5f9ea918f0ac069c83bc8020d11c299a
Reviewed-on: https://review.typo3.org/49491
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
13 files changed:
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Form/FormResultCompiler.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Resource/ResourceCompressor.php
typo3/sysext/core/Documentation/Changelog/master/Feature-77589-EXTSyntaxInPageRendererAndCompressor.rst [new file with mode: 0644]
typo3/sysext/form/Classes/View/Wizard/Element/FormWizardElement.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php

index dd276f5..a9b8f72 100644 (file)
@@ -113,18 +113,17 @@ class BackendController
         $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', '//already done', false);
         $this->pageRenderer->addExtDirectCode();
         // Add default BE javascript
-        $backendRelPath = ExtensionManagementUtility::extRelPath('backend');
         $this->jsFiles = [
             'locallang' => $this->getLocalLangFileName(),
-            'md5' => $backendRelPath . 'Resources/Public/JavaScript/md5.js',
-            'modulemenu' => $backendRelPath . 'Resources/Public/JavaScript/modulemenu.js',
-            'evalfield' => $backendRelPath . 'Resources/Public/JavaScript/jsfunc.evalfield.js',
-            'notifications' => $backendRelPath . 'Resources/Public/JavaScript/notifications.js',
-            'backend' => $backendRelPath . 'Resources/Public/JavaScript/backend.js',
-            'viewport' => $backendRelPath . 'Resources/Public/JavaScript/extjs/viewport.js',
-            'iframepanel' => $backendRelPath . 'Resources/Public/JavaScript/iframepanel.js',
-            'backendcontentiframe' => $backendRelPath . 'Resources/Public/JavaScript/extjs/backendcontentiframe.js',
-            'viewportConfiguration' => $backendRelPath . 'Resources/Public/JavaScript/extjs/viewportConfiguration.js',
+            'md5' => 'EXT:backend/Resources/Public/JavaScript/md5.js',
+            'modulemenu' => 'EXT:backend/Resources/Public/JavaScript/modulemenu.js',
+            'evalfield' => 'EXT:backend/Resources/Public/JavaScript/jsfunc.evalfield.js',
+            'notifications' => 'EXT:backend/Resources/Public/JavaScript/notifications.js',
+            'backend' => 'EXT:backend/Resources/Public/JavaScript/backend.js',
+            'viewport' => 'EXT:backend/Resources/Public/JavaScript/extjs/viewport.js',
+            'iframepanel' => 'EXT:backend/Resources/Public/JavaScript/iframepanel.js',
+            'backendcontentiframe' => 'EXT:backend/Resources/Public/JavaScript/extjs/backendcontentiframe.js',
+            'viewportConfiguration' => 'EXT:backend/Resources/Public/JavaScript/extjs/viewportConfiguration.js',
         ];
         $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LoginRefresh', 'function(LoginRefresh) {
                        LoginRefresh.setLoginFramesetUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('login_frameset')) . ');
index 9486e51..8e50331 100644 (file)
@@ -205,12 +205,11 @@ class FormResultCompiler
     protected function JSbottom($formname = 'forms[0]')
     {
         $languageService = $this->getLanguageService();
-        $jsFile = [];
+        $pageRenderer = $this->getPageRenderer();
 
         // @todo: this is messy here - "additional hidden fields" should be handled elsewhere
         $html = implode(LF, $this->hiddenFieldAccum);
-        $backendRelPath = ExtensionManagementUtility::extRelPath('backend');
-        $this->loadJavascriptLib($backendRelPath . 'Resources/Public/JavaScript/md5.js');
+        $pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/md5.js');
         // 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('wizard_element_browser')) . ');
@@ -220,7 +219,6 @@ class FormResultCompiler
                        FormEngineValidation.registerReady();
                }';
 
-        $pageRenderer = $this->getPageRenderer();
         foreach ($this->requireJsModules as $moduleName => $callbacks) {
             if (!is_array($callbacks)) {
                 $callbacks = [$callbacks];
@@ -231,7 +229,7 @@ class FormResultCompiler
         }
         $pageRenderer->loadJquery();
         $pageRenderer->loadExtJS();
-        $pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/notifications.js');
+        $pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/notifications.js');
         $beUserAuth = $this->getBackendUserAuthentication();
 
         // define the window size of the element browser etc.
@@ -268,7 +266,7 @@ class FormResultCompiler
         ];
         $pageRenderer->addInlineSettingArray('Popup', $popupSettings);
 
-        $this->loadJavascriptLib($backendRelPath . 'Resources/Public/JavaScript/jsfunc.tbe_editor.js');
+        $pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ValueSlider');
         // Needed for FormEngine manipulation (date picker)
         $dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? ['MM-DD-YYYY', 'HH:mm MM-DD-YYYY'] : ['DD-MM-YYYY', 'HH:mm DD-MM-YYYY']);
@@ -284,15 +282,12 @@ class FormResultCompiler
         }
         // Load codemirror for T3Editor
         if (ExtensionManagementUtility::isLoaded('t3editor')) {
-            $this->loadJavascriptLib(ExtensionManagementUtility::extRelPath('t3editor') . 'Resources/Public/JavaScript/Contrib/codemirror/js/codemirror.js');
+            $pageRenderer->addJsFile('EXT:t3editor/Resources/Public/JavaScript/Contrib/codemirror/js/codemirror.js');
         }
         // We want to load jQuery-ui inside our js. Enable this using requirejs.
-        $this->loadJavascriptLib($backendRelPath . 'Resources/Public/JavaScript/jsfunc.inline.js');
+        $pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/jsfunc.inline.js');
         $out = '
                inline.setNoTitleString(' . GeneralUtility::quoteJSvalue(BackendUtility::getNoRecordTitle(true)) . ');
-               ';
-
-        $out .= '
                TBE_EDITOR.formname = "' . $formname . '";
                TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
                TBE_EDITOR.isPalettedoc = null;
@@ -324,23 +319,7 @@ class FormResultCompiler
         }
         $out .= LF . implode(LF, $this->additionalJS_post) . LF . $this->extJSCODE;
 
-        $spacer = LF . TAB;
-        $out = $html . $spacer . implode($spacer, $jsFile) . GeneralUtility::wrapJS($out);
-
-        return $out;
-    }
-
-    /**
-     * Includes a javascript library that exists in the core /typo3/ directory. The
-     * backpath is automatically applied.
-     *
-     * @param string $lib Library name. Call it with the full path like "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it
-     * @return void
-     */
-    protected function loadJavascriptLib($lib)
-    {
-        $pageRenderer = $this->getPageRenderer();
-        $pageRenderer->addJsFile($lib);
+        return $html . LF . TAB . GeneralUtility::wrapJS($out);
     }
 
     /**
index b24f32a..a55288d 100644 (file)
@@ -615,7 +615,7 @@ function jumpToUrl(URL) {
         // add docstyles
         $this->docStyle();
         if ($this->extDirectStateProvider) {
-            $this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/JavaScript/ExtDirect.StateProvider.js');
+            $this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
         }
         $this->pageRenderer->addHeaderData($this->JScode);
         foreach ($this->JScodeArray as $name => $code) {
@@ -631,7 +631,7 @@ function jumpToUrl(URL) {
         // Note: please do not reference "bootstrap" outside of the TYPO3 Core (not in your own extensions)
         // as this is preliminary as long as Twitter bootstrap does not support AMD modules
         // this logic will be changed once Twitter bootstrap 4 is included
-        $this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('core') . 'Resources/Public/JavaScript/Contrib/bootstrap/bootstrap.js');
+        $this->pageRenderer->addJsFile('EXT:core/Resources/Public/JavaScript/Contrib/bootstrap/bootstrap.js');
 
         // hook for additional headerData
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
index a60a367..7741395 100644 (file)
@@ -2140,7 +2140,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
             $this->extOnReadyCode = [];
             // Include TYPO3.l10n object
             if (TYPO3_MODE === 'BE') {
-                $out .= '<script src="' . $this->processJsFile(ExtensionManagementUtility::extRelPath('lang') . 'Resources/Public/JavaScript/Typo3Lang.js') . '" type="text/javascript" charset="utf-8"></script>' . LF;
+                $out .= '<script src="' . $this->processJsFile('EXT:lang/Resources/Public/JavaScript/Typo3Lang.js') . '" type="text/javascript" charset="utf-8"></script>' . LF;
             }
             if ($this->extJScss) {
                 if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) {
@@ -2276,8 +2276,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         $cssFiles = '';
         if (!empty($this->cssLibs)) {
             foreach ($this->cssLibs as $file => $properties) {
-                $file = GeneralUtility::resolveBackPath($file);
-                $file = GeneralUtility::createVersionNumberedFilename($file);
+                $file = $this->getStreamlinedFileName($file);
                 $tag = '<link rel="' . htmlspecialchars($properties['rel'])
                     . '" type="text/css" href="' . htmlspecialchars($file)
                     . '" media="' . htmlspecialchars($properties['media']) . '"'
@@ -2308,8 +2307,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         $cssFiles = '';
         if (!empty($this->cssFiles)) {
             foreach ($this->cssFiles as $file => $properties) {
-                $file = GeneralUtility::resolveBackPath($file);
-                $file = GeneralUtility::createVersionNumberedFilename($file);
+                $file = $this->getStreamlinedFileName($file);
                 $tag = '<link rel="' . htmlspecialchars($properties['rel'])
                     . '" type="text/css" href="' . htmlspecialchars($file)
                     . '" media="' . htmlspecialchars($properties['media']) . '"'
@@ -2363,8 +2361,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         $jsFooterLibs = '';
         if (!empty($this->jsLibs)) {
             foreach ($this->jsLibs as $properties) {
-                $properties['file'] = GeneralUtility::resolveBackPath($properties['file']);
-                $properties['file'] = GeneralUtility::createVersionNumberedFilename($properties['file']);
+                $properties['file'] = $this->getStreamlinedFileName($properties['file']);
                 $async = ($properties['async']) ? ' async="async"' : '';
                 $integrity = ($properties['integrity']) ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : '';
                 $tag = '<script src="' . htmlspecialchars($properties['file']) . '" type="' . htmlspecialchars($properties['type']) . '"' . $async . $integrity . '></script>';
@@ -2406,8 +2403,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         $jsFooterFiles = '';
         if (!empty($this->jsFiles)) {
             foreach ($this->jsFiles as $file => $properties) {
-                $file = GeneralUtility::resolveBackPath($file);
-                $file = GeneralUtility::createVersionNumberedFilename($file);
+                $file = $this->getStreamlinedFileName($file);
                 $async = ($properties['async']) ? ' async="async"' : '';
                 $integrity = ($properties['integrity']) ? ' integrity="' . htmlspecialchars($properties['integrity']) . '"' : '';
                 $tag = '<script src="' . htmlspecialchars($file) . '" type="' . htmlspecialchars($properties['type']) . '"' . $async . $integrity . '></script>';
@@ -2725,13 +2721,42 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function processJsFile($filename)
     {
+        $filename = $this->getStreamlinedFileName($filename, false);
         if ($this->compressJavascript) {
-            return $this->getCompressor()->compressJsFile($filename);
+            $filename = $this->getCompressor()->compressJsFile($filename);
         } elseif (TYPO3_MODE === 'FE') {
-            return GeneralUtility::createVersionNumberedFilename($filename);
+            $filename = GeneralUtility::createVersionNumberedFilename($filename);
+        }
+        return PathUtility::getAbsoluteWebPath($filename);
+    }
+
+    /**
+     * This function acts as a wrapper to allow relative and paths starting with EXT: to be dealt with
+     * in this very case to always return the absolute web path to be included directly before output.
+     *
+     * This is mainly added so the EXT: syntax can be resolved for PageRenderer in one central place,
+     * and hopefully removed in the future by one standard API call.
+     *
+     * @param string $file the filename to process
+     * @param bool $prepareForOutput whether the file should be prepared as version numbered file and prefixed as absolute webpath
+     * @return string
+     * @internal
+     */
+    protected function getStreamlinedFileName($file, $prepareForOutput = true)
+    {
+        if (substr($file, 0, 4) === 'EXT:') {
+            $file = GeneralUtility::getFileAbsFileName($file);
+            // as the path is now absolute, make it "relative" to the current script to stay compatible
+            $file = PathUtility::getRelativePathTo($file);
+            $file = rtrim($file, '/');
         } else {
-            return $filename;
+            $file = GeneralUtility::resolveBackPath($file);
+        }
+        if ($prepareForOutput) {
+            $file = GeneralUtility::createVersionNumberedFilename($file);
+            $file = PathUtility::getAbsoluteWebPath($file);
         }
+        return $file;
     }
 
     /**
index 8150119..9f3260c 100644 (file)
@@ -429,7 +429,9 @@ class ResourceCompressor
             $filename = TYPO3_mainDir . $filename;
         }
         // build the file path relatively to the PATH_site
-        if (substr($filename, 0, 3) === '../') {
+        if (substr($filename, 0, 4) === 'EXT:') {
+            $file = GeneralUtility::getFileAbsFileName($filename);
+        } elseif (substr($filename, 0, 3) === '../') {
             $file = GeneralUtility::resolveBackPath(PATH_typo3 . $filename);
         } else {
             $file = PATH_site . ltrim($filename, '/');
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-77589-EXTSyntaxInPageRendererAndCompressor.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-77589-EXTSyntaxInPageRendererAndCompressor.rst
new file mode 100644 (file)
index 0000000..4cb9d79
--- /dev/null
@@ -0,0 +1,9 @@
+============================================================
+Feature: #77589 - EXT: syntax in PageRenderer and Compressor
+============================================================
+
+Description
+===========
+
+It is now possible to use the EXT: prefix for referencing files inside extensions within the ``PageRenderer`` and ``ResourceCompressor``
+PHP classes for adding JavaSyntax or StyleSheet files.
\ No newline at end of file
index 38ac08b..c219d9b 100644 (file)
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Form\View\Wizard\Element;
  */
 
 use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\Service\TypoScriptService;
@@ -157,18 +156,11 @@ class FormWizardElement extends AbstractFormElement
     }
 
     /**
-     * @see \TYPO3\CMS\Form\View\Wizard\WizardView::loadCss
+     * Load the wizards css
      */
     protected function resultAddWizardCss()
     {
-        $cssFiles = [
-            'form.css'
-        ];
-        $baseUrl = ExtensionManagementUtility::extRelPath('form') . 'Resources/Public/Css/';
-        // Load the wizards css
-        foreach ($cssFiles as $cssFile) {
-            $this->resultArray['stylesheetFiles'][] = $baseUrl . $cssFile;
-        }
+        $this->resultArray['stylesheetFiles'][] = 'EXT:form/Resources/Public/Css/form.css';
     }
 
     /**
index 62eb348..0e735c9 100644 (file)
@@ -24,7 +24,6 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Linkvalidator\LinkAnalyzer;
 
@@ -253,7 +252,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
             $this->isAccessibleForCurrentUser = true;
         }
 
-        $this->doc->addStyleSheet('module', ExtensionManagementUtility::extRelPath('linkvalidator') . 'Resources/Public/Css/linkvalidator.css');
+        $this->getPageRenderer()->addCssFile('EXT:linkvalidator/Resources/Public/Css/linkvalidator.css', 'stylesheet', 'screen');
         $this->getPageRenderer()->loadJquery();
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Linkvalidator/Linkvalidator');
 
index 252bb62..9d4a740 100644 (file)
@@ -30,7 +30,6 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -369,7 +368,7 @@ class SetupModuleController extends AbstractModule
             BackendUtility::setUpdateSignal('updatePageTree');
         }
         // Start page:
-        $this->moduleTemplate->loadJavascriptLib(ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/JavaScript/md5.js');
+        $this->moduleTemplate->getPageRenderer()->addJsFile('EXT:backend/Resources/Public/JavaScript/md5.js');
         // Use a wrapper div
         $this->content .= '<div id="user-setup-wrapper">';
         // Load available backend modules
index c15f7d7..fe30393 100644 (file)
@@ -158,7 +158,7 @@ class T3editorElement extends AbstractFormElement
      */
     protected function initJavascriptCode()
     {
-        $this->resultArray['stylesheetFiles'][] = $this->relExtPath . 'Resources/Public/Css/t3editor.css';
+        $this->resultArray['stylesheetFiles'][] = 'EXT:t3editor/Resources/Public/Css/t3editor.css';
         if ($this->mode === self::MODE_TYPOSCRIPT) {
             foreach ($this->codeCompletionComponents as $codeCompletionComponent) {
                 $this->resultArray['requireJsModules'][] = 'TYPO3/CMS/T3editor/Plugins/CodeCompletion/' . $codeCompletionComponent;
index 1e8fb57..da4e5c5 100644 (file)
@@ -21,7 +21,6 @@ use TYPO3\CMS\Backend\Template\ModuleTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Taskcenter\TaskInterface;
@@ -316,14 +315,9 @@ class TaskModuleController extends BaseScriptClass
                 // Check for custom icon
                 if (!empty($item['icon'])) {
                     if (strpos($item['icon'], '<img ') === false) {
-                        $absIconPath = GeneralUtility::getFileAbsFileName($item['icon']);
-                        // If the file indeed exists, assemble relative path to it
-                        if (file_exists($absIconPath)) {
-                            $icon = '../' . str_replace(PATH_site, '', $absIconPath);
-                            $icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />';
-                        }
-                        if (@is_file($icon)) {
-                            $icon = '<img src="' . PathUtility::getAbsoluteWebPath($icon) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />';
+                        $iconFile = GeneralUtility::getFileAbsFileName($item['icon']);
+                        if (@is_file($iconFile)) {
+                            $icon = '<img src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($iconFile)) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />';
                         }
                     } else {
                         $icon = $item['icon'];
@@ -387,7 +381,7 @@ class TaskModuleController extends BaseScriptClass
     {
         $content = '';
         $tasks = [];
-        $icon = ExtensionManagementUtility::extRelPath('taskcenter') . 'Resources/Public/Icons/module-taskcenter.svg';
+        $defaultIcon = 'EXT:taskcenter/Resources/Public/Icons/module-taskcenter.svg';
         // Render the tasks only if there are any available
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) && !empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'] as $extKey => $extensionReports) {
@@ -398,10 +392,7 @@ class TaskModuleController extends BaseScriptClass
                     $link = BackendUtility::getModuleUrl('user_task') . '&SET[function]=' . $extKey . '.' . $taskClass;
                     $taskTitle = $this->getLanguageService()->sL($task['title']);
                     $taskDescriptionHtml = '';
-                    // Check for custom icon
-                    if (!empty($task['icon'])) {
-                        $icon = GeneralUtility::getFileAbsFileName($task['icon']);
-                    }
+
                     if (class_exists($taskClass)) {
                         $taskInstance = GeneralUtility::makeInstance($taskClass, $this);
                         if ($taskInstance instanceof TaskInterface) {
@@ -414,7 +405,7 @@ class TaskModuleController extends BaseScriptClass
                         'title' => $taskTitle,
                         'descriptionHtml' => $taskDescriptionHtml,
                         'description' => $this->getLanguageService()->sL($task['description']),
-                        'icon' => $icon,
+                        'icon' => !empty($task['icon']) ? $task['icon'] : $defaultIcon,
                         'link' => $link,
                         'uid' => $extKey . '.' . $taskClass
                     ];
index efb6364..13fbbfd 100644 (file)
@@ -19,7 +19,6 @@ use TYPO3\CMS\Backend\View\BackendTemplateView;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
@@ -65,10 +64,9 @@ class PreviewController extends AbstractController
     protected function initializeAction()
     {
         parent::initializeAction();
-        $backendRelPath = ExtensionManagementUtility::extRelPath('backend');
         $this->stageService = GeneralUtility::makeInstance(StagesService::class);
         $this->workspaceService = GeneralUtility::makeInstance(WorkspaceService::class);
-        $this->pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/ExtDirect.StateProvider.js');
+        $this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
         $this->pageRenderer->loadExtJS(false, false);
         // Load  JavaScript:
         $this->pageRenderer->addExtDirectCode([
index 82b5a16..af5e104 100644 (file)
@@ -18,7 +18,6 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
 use TYPO3\CMS\Core\Imaging\Icon;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
 use TYPO3\CMS\Workspaces\Service\WorkspaceService;
@@ -202,8 +201,7 @@ class ReviewController extends AbstractController
     protected function initializeAction()
     {
         parent::initializeAction();
-        $backendRelPath = ExtensionManagementUtility::extRelPath('backend');
-        $this->pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/ExtDirect.StateProvider.js');
+        $this->pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
         $this->pageRenderer->loadExtJS(false, false);
         $states = $this->getBackendUser()->uc['moduleData']['Workspaces']['States'];
         $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states);