[CLEANUP] Cleanup backend toolbar item registration 68/32668/5
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 9 Sep 2014 08:44:26 +0000 (10:44 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 9 Sep 2014 10:05:15 +0000 (12:05 +0200)
* Remove side effects from class file
* Move registration script to Resources/PHP folder

Resolves: #61467
Releases: 6.3
Change-Id: I0786a1d2bddefac17780168acbd2e088c2e5690a
Reviewed-on: http://review.typo3.org/32668
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
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/opendocs/Resources/PHP/RegisterToolbarItem.php [new file with mode: 0644]
typo3/sysext/opendocs/ext_localconf.php [new file with mode: 0644]
typo3/sysext/opendocs/ext_tables.php
typo3/sysext/opendocs/registerToolbarItem.php [deleted file]
typo3/sysext/workspaces/Classes/ExtDirect/WorkspaceSelectorToolbarItem.php
typo3/sysext/workspaces/Resources/PHP/RegisterToolbarItem.php [new file with mode: 0644]
typo3/sysext/workspaces/ext_localconf.php

diff --git a/typo3/sysext/opendocs/Resources/PHP/RegisterToolbarItem.php b/typo3/sysext/opendocs/Resources/PHP/RegisterToolbarItem.php
new file mode 100644 (file)
index 0000000..8fb3567
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+defined('TYPO3_MODE') or die();
+
+if (TYPO3_MODE === 'BE') {
+       // Now register the class as toolbar item
+       $GLOBALS['TYPO3backend']->addToolbarItem('opendocs', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
+}
diff --git a/typo3/sysext/opendocs/ext_localconf.php b/typo3/sysext/opendocs/ext_localconf.php
new file mode 100644 (file)
index 0000000..c77a87b
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+defined('TYPO3_MODE') or die();
+
+if (TYPO3_MODE === 'BE') {
+       // Register toolbar item
+       $GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('opendocs'). 'Resources/PHP/RegisterToolbarItem.php';
+}
\ No newline at end of file
index 3b0ef22..1b24afd 100644 (file)
@@ -2,9 +2,6 @@
 defined('TYPO3_MODE') or die();
 
 if (TYPO3_MODE === 'BE') {
-       $opendocsPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('opendocs');
-       // Register toolbar item
-       $GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = $opendocsPath . 'registerToolbarItem.php';
        // Register AJAX calls
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('OpendocsController::renderMenu', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController->renderAjax');
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('OpendocsController::closeDocument', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController->closeDocument');
diff --git a/typo3/sysext/opendocs/registerToolbarItem.php b/typo3/sysext/opendocs/registerToolbarItem.php
deleted file mode 100644 (file)
index 8fb3567..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-defined('TYPO3_MODE') or die();
-
-if (TYPO3_MODE === 'BE') {
-       // Now register the class as toolbar item
-       $GLOBALS['TYPO3backend']->addToolbarItem('opendocs', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController');
-}
index 0d14304..cb14006 100644 (file)
@@ -16,10 +16,6 @@ namespace TYPO3\CMS\Workspaces\ExtDirect;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
-if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
-       require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('backend') . 'Classes/Toolbar/ToolbarItemHookInterface.php';
-}
-
 /**
  * Class to render the workspace selector
  *
@@ -153,6 +149,3 @@ class WorkspaceSelectorToolbarItem implements \TYPO3\CMS\Backend\Toolbar\Toolbar
 
 }
 
-if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
-       $GLOBALS['TYPO3backend']->addToolbarItem('workSpaceSelector', 'TYPO3\\CMS\\Workspaces\\ExtDirect\\WorkspaceSelectorToolbarItem');
-}
diff --git a/typo3/sysext/workspaces/Resources/PHP/RegisterToolbarItem.php b/typo3/sysext/workspaces/Resources/PHP/RegisterToolbarItem.php
new file mode 100644 (file)
index 0000000..cc86345
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+defined('TYPO3_MODE') or die();
+
+$GLOBALS['TYPO3backend']->addToolbarItem('workSpaceSelector', 'TYPO3\\CMS\\Workspaces\\ExtDirect\\WorkspaceSelectorToolbarItem');
\ No newline at end of file
index 711b53a..7e8a6d2 100644 (file)
@@ -1,11 +1,6 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-if (TYPO3_MODE === 'BE') {
-       $workspaceSelectorToolbarItemClassPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('workspaces', 'Classes/ExtDirect/WorkspaceSelectorToolbarItem.php');
-       $GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = $workspaceSelectorToolbarItemClassPath;
-}
-
 // Register the autopublishing task
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Workspaces\\Task\\AutoPublishTask'] = array(
        'extension' => $_EXTKEY,
@@ -33,6 +28,8 @@ if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations
 }
 
 if (TYPO3_MODE === 'BE') {
+       $GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'][] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Resources/PHP/RegisterToolbarItem.php';
+
        // If publishing/swapping dependent parent-child references, consider all parents and children
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('options.workspaces.considerReferences = 1');
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'][] = 'TYPO3\\CMS\\Workspaces\\ExtDirect\\PagetreeCollectionsProcessor';