[FEATURE] Remove conf.php for ext:filelist 92/33992/8
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 11 Nov 2014 21:52:52 +0000 (22:52 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Thu, 4 Dec 2014 22:05:52 +0000 (23:05 +0100)
In order to be able to remove the conf.php a few fixes are needed.
The module dispatcher checks for a conf.php file and results in a error.
The language labels for the module menu for example are missing currently.
This patch adds a possibility to register the labels also in addModule
function.

Resolves: #62880
Releases: master
Change-Id: I5765cf84858d1c328739c761d23c97307abf7ede
Reviewed-on: http://review.typo3.org/33992
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Steffen Müller <typo3@t3node.com>
Tested-by: Steffen Müller <typo3@t3node.com>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/mod.php
typo3/sysext/backend/Classes/Module/ModuleLoader.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/filelist/ext_tables.php
typo3/sysext/filelist/mod1/conf.php [deleted file]

index 6942247..182e6f7 100644 (file)
@@ -27,7 +27,10 @@ if (!$formprotection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP(
 }
 if ($temp_path = $TBE_MODULES['_PATHS'][$moduleName]) {
        $MCONF['_'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName);
-       require $temp_path . 'conf.php';
+       if (file_exists($temp_path . 'conf.php')) {
+               require $temp_path . 'conf.php';
+       }
+
        $BACK_PATH = '';
        require $temp_path . 'index.php';
        $isDispatched = TRUE;
index 8cedeaa..360e8a9 100644 (file)
@@ -255,7 +255,12 @@ class ModuleLoader {
                                if (is_object($GLOBALS['LANG'])) {
                                        // $setupInformation['labels']['default']['tabs_images']['tab'] is for modules the reference
                                        // to the module icon.
-                                       $defaultLabels = $setupInformation['labels']['default'];
+                                       if (isset($setupInformation['configuration']['labels'])) {
+                                               $defaultLabels = $setupInformation['configuration']['labels'];
+                                       } else {
+                                               $defaultLabels = $setupInformation['labels']['default'];
+                                       }
+
                                        // Here the path is transformed to an absolute reference.
                                        if ($defaultLabels['tabs_images']['tab']) {
                                                // Initializing search for alternative icon:
index 987e3a4..70cec72 100644 (file)
@@ -25,10 +25,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class FileListController {
 
        /**
-        * Module configuration
-        *
-        * @var array
-        */
+       * Module configuration
+       *
+       * @var array
+       * @deprecated since TYPO3 CMS 7, will be removed in CMS 8. The Module gets configured by ExtensionManagementUtility::addModule() in ext_tables.php
+       */
        public $MCONF = array();
 
        /**
@@ -111,12 +112,18 @@ class FileListController {
        public $filelist = NULL;
 
        /**
+        * The name of the module
+        *
+        * @var string
+        */
+       protected $moduleName = 'file_list';
+
+       /**
         * Constructor
         */
        public function __construct() {
                $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_file_list.xlf');
                $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xlf');
-               $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
        }
 
        /**
@@ -124,6 +131,7 @@ class FileListController {
         * Incoming GET vars include id, pointer, table, imagemode
         *
         * @return void
+        * @throws \RuntimeException
         */
        public function init() {
                // Setting GPvars:
@@ -133,8 +141,7 @@ class FileListController {
                $this->imagemode = GeneralUtility::_GP('imagemode');
                $this->cmd = GeneralUtility::_GP('cmd');
                $this->overwriteExistingFiles = GeneralUtility::_GP('overwriteExistingFiles');
-               // Setting module name:
-               $this->MCONF = $GLOBALS['MCONF'];
+
                try {
                        if ($combinedIdentifier) {
                                /** @var $fileFactory \TYPO3\CMS\Core\Resource\ResourceFactory */
@@ -207,7 +214,7 @@ class FileListController {
                $this->MOD_SETTINGS = BackendUtility::getModuleData(
                        $this->MOD_MENU,
                        GeneralUtility::_GP('SET'),
-                       $this->MCONF['name']
+                       $this->moduleName
                );
        }
 
@@ -444,7 +451,7 @@ class FileListController {
                );
                // Add shortcut
                if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
-                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
+                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->moduleName);
                }
                // FileList Module CSH:
                $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module');
index cedb689..e823601 100644 (file)
@@ -6,6 +6,18 @@ if (TYPO3_MODE === 'BE') {
                'file',
                'list',
                '',
-               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod1/'
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'mod1/',
+               array(
+                       'script' => '_DISPATCH',
+                       'access' => 'user,group',
+                       'name' => 'file_list',
+                       'workspaces' => 'online,custom',
+                       'labels' => array(
+                               'tabs_images' => array(
+                                       'tab' => '../Resources/Public/Icons/module-filelist.png',
+                               ),
+                               'll_ref' => 'LLL:EXT:lang/locallang_mod_file_list.xlf',
+                       ),
+               )
        );
 }
diff --git a/typo3/sysext/filelist/mod1/conf.php b/typo3/sysext/filelist/mod1/conf.php
deleted file mode 100644 (file)
index 37a50d1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-$MLANG['default']['tabs_images']['tab'] = '../Resources/Public/Icons/module-filelist.png';
-$MLANG['default']['ll_ref'] = 'LLL:EXT:lang/locallang_mod_file_list.xlf';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = 'user,group';
-$MCONF['name'] = 'file_list';
-$MCONF['workspaces'] = 'online,custom';