[BUGFIX] Replace shortcut item icons with sprites 97/34597/5
authorBenjamin Mack <benni@typo3.org>
Tue, 25 Nov 2014 12:08:50 +0000 (13:08 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 26 Nov 2014 19:48:23 +0000 (20:48 +0100)
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>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/t3skin/Classes/Slot/IconStyleModifier.php

index 4fbf6f6..37dfe1f 100644 (file)
@@ -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;
        }
 
        /**
index 83c2e4b..052b222 100644 (file)
@@ -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',