From 1ea0a7dd4b380c7c64dc901ccef48c52396dcc3d Mon Sep 17 00:00:00 2001
From: Markus Guenther <mail@markus-guenther.de>
Date: Fri, 7 Aug 2015 10:35:29 +0200
Subject: [PATCH] [TASK] Replace sprite icon "actions-document-move" with the
 new IconFactory
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Replaces all IconUtility::getSpriteIcon calls for the icon
actions-document-move with the new IconFactory.

Change-Id: I52ae5ce611c138ff73fc009780b5ebc382eb41eb
Resolves: #68817
Releases: master
Reviewed-on: http://review.typo3.org/42346
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
---
 .../core/Classes/Imaging/IconRegistry.php      |  6 ++++++
 .../frontend/Classes/View/AdminPanelView.php   | 11 +++++++++--
 .../Classes/RecordList/DatabaseRecordList.php  | 18 ++++++++++++++++--
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/typo3/sysext/core/Classes/Imaging/IconRegistry.php b/typo3/sysext/core/Classes/Imaging/IconRegistry.php
index c6b3ac1ae47c..a7598b0a2c12 100644
--- a/typo3/sysext/core/Classes/Imaging/IconRegistry.php
+++ b/typo3/sysext/core/Classes/Imaging/IconRegistry.php
@@ -62,6 +62,12 @@ class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
 				'name' => 'upload',
 			)
 		),
+		'actions-document-move' => array(
+			'provider' => FontawesomeIconProvider::class,
+			'options' => array(
+				'name' => 'arrows',
+			)
+		),
 		'actions-document-open' => array(
 			'provider' => FontawesomeIconProvider::class,
 			'options' => array(
diff --git a/typo3/sysext/frontend/Classes/View/AdminPanelView.php b/typo3/sysext/frontend/Classes/View/AdminPanelView.php
index 1748664d05a0..a5cb5f014bfb 100755
--- a/typo3/sysext/frontend/Classes/View/AdminPanelView.php
+++ b/typo3/sysext/frontend/Classes/View/AdminPanelView.php
@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Frontend\View;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Imaging\Icon;
+use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -598,6 +600,9 @@ class AdminPanelView {
 	 * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
 	 */
 	public function ext_makeToolBar() {
+		/** @var IconFactory $iconFactory */
+		$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+
 		//  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
 		$tsConfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
 		$tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension'];
@@ -618,8 +623,10 @@ class AdminPanelView {
 			$toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($newContentWizScriptPath . 'id=' . $id . $params . '&returnUrl=' . rawurlencode($returnUrl)) . '">' . $icon . '</a>';
 		}
 		if ($perms & Permission::PAGE_EDIT) {
-			$icon = IconUtility::getSpriteIcon('actions-document-move', array('title' => $this->extGetLL('edit_move_page', FALSE)));
-			$toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl])) . '">' . $icon . '</a>';
+			$icon = $iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL);
+			$link = BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl]);
+			$toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) .
+			$toolBar .= '" title="' . $this->extGetLL('edit_move_page', FALSE) . '">' . $icon . '</a>';
 		}
 		if ($perms & Permission::PAGE_NEW) {
 			$icon = IconUtility::getSpriteIcon('actions-page-new', array('title' => $this->extGetLL('edit_newPage', FALSE)));
diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
index b4b743987b7e..0732e4f02423 100644
--- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
+++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
@@ -18,6 +18,8 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Imaging\Icon;
+use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
@@ -191,6 +193,18 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
 	 */
 	protected $editable = TRUE;
 
+	/**
+	 * @var IconFactory
+	 */
+	protected $iconFactory;
+
+	/**
+	 * Constructor
+	 */
+	public function __construct() {
+		$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
+	}
+
 	/**
 	 * Create the panel of buttons for submitting the form or otherwise perform
 	 * operations.
@@ -1242,8 +1256,8 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
 		if ($permsEdit && ($table === 'tt_content' || $table === 'pages')) {
 			$onClick = 'return jumpExt(\'' . BackendUtility::getModuleUrl('move_element') . '&table=' . $table . '&uid=' . $row['uid'] . '\');';
 			$linkTitleLL = $this->getLanguageService()->getLL('move_' . ($table === 'tt_content' ? 'record' : 'page'), TRUE);
-			$spriteIcon = $table === 'tt_content' ? 'actions-document-move' : 'actions-page-move';
-			$moveAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $linkTitleLL . '">' . IconUtility::getSpriteIcon($spriteIcon) . '</a>';
+			$icon = ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-move') : $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL));
+			$moveAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $linkTitleLL . '">' . $icon . '</a>';
 			$this->addActionToCellGroup($cells, $moveAction, 'move');
 		}
 		// If the table is NOT a read-only table, then show these links:
-- 
GitLab