[BUGFIX] ShortcutVH must not ignore options.enableBookmarks 81/21681/2
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 27 Jun 2013 08:41:41 +0000 (10:41 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 27 Jun 2013 09:14:06 +0000 (11:14 +0200)
Shortcuts/Bookmarks can be disabled for users by using
TsConfig options.enableBookmarks = 0.

This setting must be checked in the ViewHelper too.

Change-Id: I5f53b9cb2863ac8a9e7501e63299482567509f2b
Resolves: #49220
Releases: 6.2
Reviewed-on: https://review.typo3.org/21681
Reviewed-by: Eric Chavaillaz
Tested-by: Eric Chavaillaz
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/fluid/Classes/ViewHelpers/Be/Buttons/ShortcutViewHelper.php

index 1c93389..803d205 100644 (file)
@@ -55,17 +55,23 @@ class ShortcutViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackend
         * @see template::makeShortcutIcon()
         */
        public function render(array $getVars = array(), array $setVars = array()) {
-               $doc = $this->getDocInstance();
-               $currentRequest = $this->controllerContext->getRequest();
-               $extensionName = $currentRequest->getControllerExtensionName();
-               $moduleName = $currentRequest->getPluginName();
-               if (count($getVars) === 0) {
-                       $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
-                       $getVars = array('id', 'M', $modulePrefix);
+               $enableBookmarks = $GLOBALS['BE_USER']->getTSConfigVal('options.enableBookmarks');
+
+               if ($enableBookmarks) {
+                       $doc = $this->getDocInstance();
+                       $currentRequest = $this->controllerContext->getRequest();
+                       $extensionName = $currentRequest->getControllerExtensionName();
+                       $moduleName = $currentRequest->getPluginName();
+                       if (count($getVars) === 0) {
+                               $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
+                               $getVars = array('id', 'M', $modulePrefix);
+                       }
+                       $getList = implode(',', $getVars);
+                       $setList = implode(',', $setVars);
+                       return $doc->makeShortcutIcon($getList, $setList, $moduleName);
                }
-               $getList = implode(',', $getVars);
-               $setList = implode(',', $setVars);
-               return $doc->makeShortcutIcon($getList, $setList, $moduleName);
+               return '';
+
        }
 }