diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php index 01896ba6f404adb4cc31ab88335ef3d4fbd012cd..b1ff716b93ce0c87e7b91308eb94398210d614c8 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php @@ -543,6 +543,11 @@ class ShortcutToolbarItem implements ToolbarItemInterface $shortcutNamePrepend = ''; $url = isset($parsedBody['url']) ? $parsedBody['url'] : $queryParams['url']; + // Use given display name + if (!empty($parsedBody['displayName'])) { + $shortcutName = $parsedBody['displayName']; + } + // Determine shortcut type $url = rawurldecode($url); $queryParts = parse_url($url); diff --git a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php index c560dcd2a91e703a777d373f4be7785f6a90f115..e31d94bbb40436ec0f3054b16b86d2d8989a823f 100644 --- a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php +++ b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php @@ -14,7 +14,7 @@ namespace TYPO3\CMS\Backend\Template\Components\Buttons\Action; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Backend\Template\DocumentTemplate; +use TYPO3\CMS\Backend\Template\ModuleTemplate; use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Template\Components\Buttons\ButtonInterface; use TYPO3\CMS\Backend\Template\Components\Buttons\PositionInterface; @@ -45,6 +45,11 @@ class ShortcutButton implements ButtonInterface, PositionInterface */ protected $moduleName; + /** + * @var string + */ + protected $displayName; + /** * @var array */ @@ -82,6 +87,28 @@ class ShortcutButton implements ButtonInterface, PositionInterface return $this; } + /** + * Gets the display name of the module. + * + * @return string + */ + public function getDisplayName() + { + return $this->displayName; + } + + /** + * Sets the display name of the module. + * + * @param string $displayName + * @return ShortcutButton + */ + public function setDisplayName($displayName) + { + $this->displayName = $displayName; + return $this; + } + /** * Gets the SET variables. * @@ -190,14 +217,14 @@ class ShortcutButton implements ButtonInterface, PositionInterface public function render() { if ($this->getBackendUser()->mayMakeShortcut()) { - /** @var DocumentTemplate $documentTemplate */ - $documentTemplate = GeneralUtility::makeInstance(DocumentTemplate::class); - $shortcutMarkup = $documentTemplate->makeShortcutIcon( + /** @var ModuleTemplate $moduleTemplate */ + $moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); + $shortcutMarkup = $moduleTemplate->makeShortcutIcon( implode(',', $this->getVariables), implode(',', $this->setVariables), $this->moduleName, '', - 'btn btn-sm btn-default' + $this->displayName ); } else { $shortcutMarkup = ''; diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php index 079257ab756c04f63b5f556701373386b4a102ca..a0140a75fa1084b5af9d01ef9553b28ffc9ea9f6 100644 --- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php +++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php @@ -492,13 +492,17 @@ class ModuleTemplate * is sent to the shortcut script (so - not a fixed value!) - that is used * in file_edit and wizard_rte modules where those are really running as * a part of another module. + * @param string $displayName When given this name is used instead of the + * module name. + * @param string $classes Additional CSS classes for the link around the icon * * @return string HTML content * @todo Make this thing return a button object * @internal */ - public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '') + public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '', $displayName = '', $classes = 'btn btn-default btn-sm') { + $gvList = 'route,' . $gvList; $storeUrl = $this->makeShortcutUrl($gvList, $setList); $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI')); // Fallback for alt_mod. We still pass in the old xMOD... stuff, @@ -525,15 +529,15 @@ class ModuleTemplate $shortcutExist = BackendUtility::shortcutExists($shortcutUrl); if ($shortcutExist) { - return '<a class="active" title="">' . + return '<a class="active ' . htmlspecialchars($classes) . '" title="">' . $this->iconFactory->getIcon('actions-system-shortcut-active', Icon::SIZE_SMALL)->render() . '</a>'; } $url = GeneralUtility::quoteJSvalue(rawurlencode($shortcutUrl)); $onClick = 'top.TYPO3.ShortcutMenu.createShortcut(' . GeneralUtility::quoteJSvalue(rawurlencode($modName)) . - ', ' . $url . ', ' . $confirmationText . ', ' . $motherModule . ', this);return false;'; + ', ' . $url . ', ' . $confirmationText . ', ' . $motherModule . ', this, ' . GeneralUtility::quoteJSvalue($displayName) . ');return false;'; - return '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . + return '<a href="#" class="' . htmlspecialchars($classes) . '" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark', true) . '">' . $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</a>'; } diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js index ca2fb2ae78a43d0c7d93d1823bc0fb8da574e820..5a57450e762a0611e1ce0a9f4db4603426b98c87 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js @@ -118,7 +118,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio * @param {String} motherModule * @param {Object} shortcutButton */ - ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton) { + ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton, displayName) { if (typeof confirmationText !== 'undefined') { // @todo: translations Modal.confirm('Create bookmark', confirmationText) @@ -136,7 +136,8 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio data: { module: moduleName, url: url, - motherModName: motherModule + motherModName: motherModule, + displayName: displayName }, cache: false }).done(function() {