[BUGFIX] Utilize ButtonBar API to its full extend 32/44032/3
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Tue, 13 Oct 2015 12:50:21 +0000 (14:50 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 13 Oct 2015 13:38:17 +0000 (15:38 +0200)
With the introduction of the new Button types HelpButton and
ShortcutButton we no longer need to use FullyRenderedButtons in the core
thus changing all old code to use the new Button types

Resolves: #70653
Releases: master
Change-Id: Ie89cc2e2154af9a117f084ec8551192ffe4d6ef9
Reviewed-on: http://review.typo3.org/44032
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/cshmanual/Classes/Controller/HelpController.php
typo3/sysext/func/Classes/Controller/PageFunctionsController.php
typo3/sysext/lowlevel/Classes/View/ConfigurationView.php
typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php
typo3/sysext/reports/Classes/Controller/ReportController.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php

index 43baee6..71c5715 100644 (file)
@@ -161,10 +161,10 @@ class HelpController extends ActionController
                 $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
                 $getVars = array('id', 'M', $modulePrefix);
             }
-            $getList = implode(',', $getVars);
-            $shortcutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon($getList, '', $moduleName));
-            $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
+            $shortcutButton = $buttonBar->makeShortcutButton()
+                ->setModuleName($moduleName)
+                ->setGetVariables($getVars);
+            $buttonBar->addButton($shortcutButton);
         }
         if (isset($getVars['action']) && $getVars['action'] !== 'index') {
             $backButton = $buttonBar->makeLinkButton()
index bd010b8..08bfe6b 100644 (file)
@@ -201,8 +201,9 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
     {
         $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
         // CSH
-        $cshButton = $buttonBar->makeFullyRenderedButton()
-            ->setHtmlSource(BackendUtility::cshItem('_MOD_web_func', ''));
+        $cshButton = $buttonBar->makeHelpButton()
+            ->setModuleName('_MOD_web_func')
+            ->setFieldName('');
         $buttonBar->addButton($cshButton);
         if ($this->id && is_array($this->pageinfo)) {
             // View page
@@ -213,15 +214,11 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                 ->setHref('#');
             $buttonBar->addButton($viewButton);
             // Shortcut
-            if ($this->getBackendUser()->mayMakeShortcut()) {
-                $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                    ->setHtmlSource($this->moduleTemplate->makeShortcutIcon(
-                        'id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit',
-                        implode(',', array_keys($this->MOD_MENU)),
-                        $this->moduleName
-                    ));
-                $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
-            }
+            $shortcutButton = $buttonBar->makeShortcutButton()
+                ->setModuleName($this->moduleName)
+                ->setGetVariables(['id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])
+                ->setSetVariables(array_keys($this->MOD_MENU));
+            $buttonBar->addButton($shortcutButton);
         }
     }
 
index ce43ad8..d040ab0 100644 (file)
@@ -205,11 +205,10 @@ class ConfigurationView extends BaseScriptClass
         // Setting up the shortcut button for docheader
         $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
         // Shortcut
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->moduleTemplate->makeShortcutIcon('', 'function', $this->moduleName));
-            $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
-        }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($this->moduleName)
+            ->setSetVariables(['function']);
+        $buttonBar->addButton($shortcutButton);
 
         $this->getModuleMenu();
 
index 3133ad1..3cf6611 100644 (file)
@@ -148,19 +148,16 @@ class RecyclerModuleController extends ActionController
         $moduleName = $currentRequest->getPluginName();
         $getVars = $this->request->getArguments();
 
-        $mayMakeShortcut = $this->getBackendUser()->mayMakeShortcut();
-
-        if ($mayMakeShortcut) {
-            $extensionName = $currentRequest->getControllerExtensionName();
-            if (count($getVars) === 0) {
-                $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
-                $getVars = array('id', 'M', $modulePrefix);
-            }
-            $getList = implode(',', $getVars);
-            $shortcutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon($getList, '', $moduleName));
-            $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
+        $extensionName = $currentRequest->getControllerExtensionName();
+        if (count($getVars) === 0) {
+            $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
+            $getVars = array('id', 'M', $modulePrefix);
         }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($moduleName)
+            ->setGetVariables($getVars);
+        $buttonBar->addButton($shortcutButton);
+
         $reloadButton = $buttonBar->makeLinkButton()
             ->setHref('#')
             ->setDataAttributes(['action' => 'reload'])
index 261df26..f22cd79 100644 (file)
@@ -175,16 +175,15 @@ class ReportController extends ActionController
         $moduleName = $this->request->getPluginName();
         $getVars = $this->request->hasArgument('getVars') ? $this->request->getArgument('getVars') : [];
         $setVars = $this->request->hasArgument('setVars') ? $this->request->getArgument('setVars') : [];
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            if (count($getVars) === 0) {
-                $modulePrefix = strtolower('tx_' . $this->request->getControllerExtensionName() . '_' . $moduleName);
-                $getVars = array('id', 'M', $modulePrefix);
-            }
-            $shortcutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon(implode(',',
-                    $getVars), implode(',', $setVars), $moduleName));
-            $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT, 99);
+        if (count($getVars) === 0) {
+            $modulePrefix = strtolower('tx_' . $this->request->getControllerExtensionName() . '_' . $moduleName);
+            $getVars = array('id', 'M', $modulePrefix);
         }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($moduleName)
+            ->setGetVariables($getVars)
+            ->setSetVariables($setVars);
+        $buttonBar->addButton($shortcutButton);
     }
 
     /**
index 719dfeb..d7f61ef 100644 (file)
@@ -1658,11 +1658,10 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
             $buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
         }
         // Shortcut
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->moduleTemplate->makeShortcutIcon('', 'function', $this->moduleName));
-            $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
-        }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($this->moduleName)
+            ->setSetVariables(['function']);
+        $buttonBar->addButton($shortcutButton);
     }
 
     /**
index 1b77ba5..cb65023 100644 (file)
@@ -510,9 +510,10 @@ class SetupModuleController extends AbstractModule
         $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
         /** @var IconFactory $iconFactory */
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
-        $cshButton = $buttonBar->makeFullyRenderedButton()
-            ->setHtmlSource(BackendUtility::cshItem('_MOD_user_setup', ''));
-        $buttonBar->addButton($cshButton, ButtonBar::BUTTON_POSITION_RIGHT, 99);
+        $cshButton = $buttonBar->makeHelpButton()
+            ->setModuleName('_MOD_user_setup')
+            ->setFieldName('');
+        $buttonBar->addButton($cshButton);
 
         $saveButton = $buttonBar->makeInputButton()
             ->setName('data[save]')
@@ -522,11 +523,9 @@ class SetupModuleController extends AbstractModule
             ->setIcon($iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL));
 
         $buttonBar->addButton($saveButton);
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->moduleTemplate->makeShortcutIcon('', '', $this->moduleName));
-            $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
-        }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($this->moduleName);
+        $buttonBar->addButton($shortcutButton);
     }
 
     /******************************
index ff78666..e7edbb3 100644 (file)
@@ -438,11 +438,10 @@ class TaskModuleController extends BaseScriptClass
         $buttonBar->addButton($fullscreenButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
 
         // Shortcut
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            $shortCutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->moduleTemplate->makeShortcutIcon('', 'function', $this->moduleName));
-            $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
-        }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($this->moduleName)
+            ->setSetVariables(['function']);
+        $buttonBar->addButton($shortcutButton);
     }
 
     /**
index fa06094..0597f81 100755 (executable)
@@ -414,11 +414,10 @@ class TypoScriptTemplateModuleController extends BaseScriptClass
             }
         }
         // Shortcut
-        if ($this->getBackendUser()->mayMakeShortcut()) {
-            $shortcutButton = $buttonBar->makeFullyRenderedButton()
-                ->setHtmlSource($this->moduleTemplate->makeShortcutIcon('id', '', $this->MCONF['name']));
-            $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT, 99);
-        }
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($this->MCONF['name'])
+            ->setGetVariables(['id']);
+        $buttonBar->addButton($shortcutButton);
     }
 
     // OTHER FUNCTIONS:
index c617ac7..b57ed81 100644 (file)
@@ -78,9 +78,9 @@ class ViewModuleController extends ActionController
             $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
-        $getList = implode(',', $getVars);
-        $shortcutButton = $buttonBar->makeFullyRenderedButton()
-            ->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon($getList, '', $moduleName));
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($moduleName)
+            ->setGetVariables($getVars);
         $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
     }
 
@@ -259,8 +259,8 @@ class ViewModuleController extends ActionController
         }
         $languages = array(
             0 => isset($modSharedTSconfig['properties']['defaultLanguageLabel'])
-                    ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
-                    : $this->getLanguageService()->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage')
+                    ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')'
+                    : $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage')
         );
         $excludeHidden = $this->getBackendUser()->isAdmin() ? '' : ' AND sys_language.hidden=0';
         $rows = $this->getDatabaseConnection()->exec_SELECTgetRows(
index e70584d..1dd5e6f 100644 (file)
@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Workspaces\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\View\BackendTemplateView;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -51,10 +50,10 @@ class ReviewController extends AbstractController
             $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
-        $getList = implode(',', $getVars);
-        $shortcutButton = $buttonBar->makeFullyRenderedButton()
-            ->setHtmlSource($this->view->getModuleTemplate()->makeShortcutIcon($getList, '', $moduleName));
-        $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
+        $shortcutButton = $buttonBar->makeShortcutButton()
+            ->setModuleName($moduleName)
+            ->setGetVariables($getVars);
+        $buttonBar->addButton($shortcutButton);
     }
 
     /**