From 3f73eaa9800fce209a27f1eaf7a6c27d63353467 Mon Sep 17 00:00:00 2001 From: Benjamin Mack <benni@typo3.org> Date: Tue, 25 Nov 2014 13:08:50 +0100 Subject: [PATCH] [BUGFIX] Replace shortcut item icons with sprites If somebody adds shortcuts with several types, e.g. while editing the contents of a file or the RTE in full-screen mode or just within a module, you notice that there are missing icons and sprites. The patch changes the image tag to sprite icons. Resolves: #63319 Releases: master Change-Id: I5e2bfc127ee5436212303301b158f01c4cf8b61f Reviewed-on: http://review.typo3.org/34597 Reviewed-by: Stefan Froemken <froemken@gmail.com> Tested-by: Stefan Froemken <froemken@gmail.com> Reviewed-by: Christoph Hofmann <typo3@its-hofmann.de> Tested-by: Christoph Hofmann <typo3@its-hofmann.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> --- .../ToolbarItems/ShortcutToolbarItem.php | 18 ++++++++++-------- .../t3skin/Classes/Slot/IconStyleModifier.php | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php index 4fbf6f67e27d..37dfe1f884e8 100644 --- a/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php +++ b/typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php @@ -123,7 +123,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface { $shortcutDelete = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksDelete', TRUE); $groupIcon = IconUtility::getSpriteIcon('apps-pagetree-folder-default', array('title' => $shortcutGroup)); $editIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => $shortcutEdit)); - $deleteIcon = IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $shortcutEdit)); + $deleteIcon = IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $shortcutDelete)); $shortcutMenu[] = '<table border="0" class="shortcut-list">'; // Render shortcuts with no group (group id = 0) first $noGroupShortcuts = $this->getShortcutsByGroup(0); @@ -623,6 +623,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface { protected function getShortcutIcon($row, $shortcut) { $databaseConnection = $this->getDatabaseConnection(); $languageService = $this->getLanguageService(); + $titleAttribute = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE); switch ($row['module_name']) { case 'xMOD_alt_doc.php': $table = $shortcut['table']; @@ -660,17 +661,16 @@ class ShortcutToolbarItem implements ToolbarItemInterface { ); $result = $databaseConnection->exec_SELECT_queryArray($sqlQueryParts); $row = $databaseConnection->sql_fetch_assoc($result); - $icon = IconUtility::getIcon($table, $row); + $icon = IconUtility::getSpriteIconForRecord($table, $row, array('title' => $titleAttribute)); } elseif ($shortcut['type'] == 'new') { - $icon = IconUtility::getIcon($table, array()); + $icon = IconUtility::getSpriteIconForRecord($table, array(), array('title' => $titleAttribute)); } - $icon = IconUtility::skinImg('', $icon, '', 1); break; case 'file_edit': - $icon = 'gfx/edit_file.gif'; + $icon = IconUtility::getSpriteIcon('mimetypes-text-html', array('title' => $titleAttribute)); break; case 'wizard_rte': - $icon = 'gfx/edit_rtewiz.gif'; + $icon = IconUtility::getSpriteIcon('mimetypes-word', array('title' => $titleAttribute)); break; default: if ($languageService->moduleLabels['tabs_images'][$row['module_name'] . '_tab']) { @@ -680,11 +680,13 @@ class ShortcutToolbarItem implements ToolbarItemInterface { if (GeneralUtility::isAbsPath($icon)) { $icon = '../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($icon); } + // @todo: hardcoded width as we don't have a way to address module icons with an API yet. + $icon = '<img src="' . htmlspecialchars($icon) . '" alt="' . $titleAttribute . '" width="16">'; } else { - $icon = 'gfx/dummy_module.gif'; + $icon = IconUtility::getSpriteIcon('empty-empty', array('title' => $titleAttribute)); } } - return '<img src="' . $icon . '" alt="' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) . '" title="' . $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) . '" />'; + return $icon; } /** diff --git a/typo3/sysext/t3skin/Classes/Slot/IconStyleModifier.php b/typo3/sysext/t3skin/Classes/Slot/IconStyleModifier.php index 83c2e4b9582b..052b22255316 100644 --- a/typo3/sysext/t3skin/Classes/Slot/IconStyleModifier.php +++ b/typo3/sysext/t3skin/Classes/Slot/IconStyleModifier.php @@ -107,7 +107,7 @@ class IconStyleModifier { 't3-icon t3-icon-extensions t3-icon-extensions-scheduler t3-icon-scheduler-run-task' => 'fa-play-circle', 't3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf' => 'fa-file-pdf-o', 't3-icon t3-icon-mimetypes t3-icon-mimetypes-text t3-icon-text-html' => 'fa-file-text-o', - 't3-icon t3-icon-mimetypes t3-icon-mimetypes-word t3-icon-word' => 'fa-file-world-o', + 't3-icon t3-icon-mimetypes t3-icon-mimetypes-word t3-icon-word' => 'fa-file-word-o', 't3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-sys_language' => 'fa-globe', 't3-icon t3-icon-status t3-icon-status-dialog t3-icon-dialog-error' => 'fa-exclamation-triangle', 't3-icon t3-icon-status t3-icon-status-dialog t3-icon-dialog-information' => 'fa-info-circle', -- GitLab