From fcfa8af9a2738579b504cf6ccb91d647a09efc87 Mon Sep 17 00:00:00 2001
From: Benjamin Mack <benni@typo3.org>
Date: Sat, 22 Nov 2014 11:46:32 +0100
Subject: [PATCH] [TASK] Migrate ViewPageIcon to Sprite Icon

There are still some small places where
sprite icons are not used yet.

One is the link to the view page icon.
The call within document template
is only used twice in the core:
1. DocumentTemplate->getHeader()
2. ElementInformationController

The patch replaces the hard-coded
image tag with a sprite icon.

As this function is hardly used,
you need to know where to test:
- Go to the Info module
=> PageTSconfig
=> ViewTSconfig fieldContent
=> Choose a page in the pagetree which
is not the root page.
On the bottom you see the TSconfig
for each page, with the search
icon and the new icon once
the patch is applied.

Releases: master
Resolves: #63138
Change-Id: I8d2eaf8fe9a6cf8a6664fcaa33223ac72d637795
Reviewed-on: http://review.typo3.org/34464
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../sysext/backend/Classes/Template/DocumentTemplate.php | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
index 43e0971de8e4..d96dbe7d2a9e 100644
--- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
@@ -515,23 +515,22 @@ function jumpToUrl(URL) {
 
 	/**
 	 * Makes link to page $id in frontend (view page)
-	 * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id
+	 * Returns an icon which links to the frontend index.php document for viewing the page with id $id
 	 * $id must be a page-uid
 	 * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url)
 	 *
 	 * @param int $id The page id
 	 * @param string $backPath The current "BACK_PATH" (the back relative to the typo3/ directory)
-	 * @param string $addParams Additional parameters for the image tag(s)
 	 * @return string HTML string with linked icon(s)
 	 */
-	public function viewPageIcon($id, $backPath, $addParams = 'hspace="3"') {
+	public function viewPageIcon($id, $backPath) {
 		// If access to Web>List for user, then link to that module.
 		$str = BackendUtility::getListViewLink(array(
 			'id' => $id,
 			'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
 		), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showList'));
 		// Make link to view page
-		$str .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($id, $backPath, BackendUtility::BEgetRootLine($id))) . '">' . '<img' . IconUtility::skinImg($backPath, 'gfx/zoom.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '"' . ($addParams ? ' ' . trim($addParams) : '') . ' hspace="3" alt="" />' . '</a>';
+		$str .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($id, $backPath, BackendUtility::BEgetRootLine($id))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
 		return $str;
 	}
 
@@ -569,7 +568,7 @@ function jumpToUrl(URL) {
 		if (is_array($row) && $row['uid']) {
 			$iconImgTag = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($path)));
 			$title = strip_tags(BackendUtility::getRecordTitle($table, $row));
-			$viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'], $this->backPath, '');
+			$viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid'], $this->backPath);
 			if ($table == 'pages') {
 				$path .= ' - ' . BackendUtility::titleAttribForPages($row, '', 0);
 			}
-- 
GitLab