Commit 237523a0 authored by Stephan Großberndt's avatar Stephan Großberndt Committed by Christian Kuhn
Browse files

[TASK] Replace IconUtility with IconFactory for TCA records

Implement replacement and replace all core usages of
IconUtility::getSpriteIconForRecord() with
IconFactory->getIconForRecord().

Register and fix several icon definitions for core tables.

Resolves: #69754
Releases: master
Change-Id: I5adf4f58a0331c77458049e19c7c8ca441b9e4cf
Reviewed-on: http://review.typo3.org/43272

Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 11079fe0
......@@ -186,7 +186,7 @@ module.exports = function(grunt) {
files: {
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-compressed.svg': '<%= paths.icons %>Mimetype/mimetypes-compressed.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-excel.svg': '<%= paths.icons %>Mimetype/mimetypes-excel.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-executable-executable.svg': '<%= paths.icons %>Mimetype/mimetypes-executable-executable.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-application.svg': '<%= paths.icons %>Mimetype/mimetypes-application.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-audio.svg': '<%= paths.icons %>Mimetype/mimetypes-media-audio.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-flash.svg': '<%= paths.icons %>Mimetype/mimetypes-media-flash.svg',
'<%= paths.backend %>Public/Icons/Mimetype/mimetypes-media-image.svg': '<%= paths.icons %>Mimetype/mimetypes-media-image.svg',
......
......@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Backend\Backend\Avatar;
*/
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -53,7 +55,8 @@ class Avatar {
// Icon
$icon = '';
if ($showIcon) {
$icon = '<span class="avatar-icon">' . IconUtility::getSpriteIconForRecord('be_users', $backendUser) . '</span>';
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = '<span class="avatar-icon">' . $iconFactory->getIconForRecord('be_users', $backendUser, Icon::SIZE_SMALL)->render() . '</span>';
}
$image = $this->getImgTag($backendUser, $size);
......
......@@ -182,7 +182,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
// No shortcuts added yet, show a small help message how to add shortcuts
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
$icon = '<span title="' . $title . '">' . $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</span>';
$label = str_replace('%icon%', $icon, $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription'));
$label = str_replace('%icon%', $icon, $languageService->sL('LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription', TRUE));
$compiledShortcutMenu = '<p>' . $label . '</p>';
} else {
$compiledShortcutMenu = implode(LF, $shortcutMenu);
......@@ -756,9 +756,9 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
);
$result = $databaseConnection->exec_SELECT_queryArray($sqlQueryParts);
$row = $databaseConnection->sql_fetch_assoc($result);
$icon = IconUtility::getSpriteIconForRecord($table, (array)$row, array('title' => $titleAttribute));
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, (array)$row, Icon::SIZE_SMALL)->render() . '</span>';
} elseif ($shortcut['type'] == 'new') {
$icon = IconUtility::getSpriteIconForRecord($table, array(), array('title' => $titleAttribute));
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</span>';
}
break;
case 'file_edit':
......
......@@ -392,8 +392,9 @@ class ClickMenu {
if (!is_array($this->rec)) {
$this->rec = array();
}
// Return the printed elements:
return $this->printItems($menuItems, $root ? $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($this->rec, $table)))) . BackendUtility::getRecordTitle($table, $this->rec, TRUE));
return $this->printItems($menuItems);
}
/**
......@@ -453,7 +454,7 @@ class ClickMenu {
if (!is_array($menuItems)) {
$menuItems = array();
}
return $this->printItems($menuItems, $root ? $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render() . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) : IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($this->rec, $table)))) . BackendUtility::getRecordTitle($table, $this->rec, TRUE));
return $this->printItems($menuItems);
}
/**
......@@ -1017,7 +1018,7 @@ class ClickMenu {
// Processing by external functions?
$menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
// Return the printed elements:
return $this->printItems($menuItems, $icon . $fileObject->getName());
return $this->printItems($menuItems);
}
/**
......@@ -1190,7 +1191,7 @@ class ClickMenu {
// Processing by external functions?
$menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
// Return the printed elements:
return $this->printItems($menuItems, IconUtility::getSpriteIconForRecord($table, $this->rec, array('title' => BackendUtility::getRecordTitle($table, $this->rec, TRUE))));
return $this->printItems($menuItems);
}
/**
......
......@@ -415,7 +415,7 @@ class Clipboard {
if (is_array($rec)) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . $this->linkItemText(IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td>
<td nowrap="nowrap" class="col-icon">' . $this->linkItemText($this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render(), $rec, $table) . '</td>
<td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td>
<td nowrap="nowrap" class="col-control">
<div class="btn-group">
......@@ -486,7 +486,7 @@ class Clipboard {
foreach ($rows as $rec) {
$lines[] = '
<tr>
<td nowrap="nowrap" class="col-icon">' . IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin-left: 38px;')) . '</td>
<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
<td nowrap="nowrap" class="col-control"></td>
</tr>';
......
......@@ -679,7 +679,7 @@ class ElementInformationController {
$parentRecordTitle = is_array($parentRecord)
? BackendUtility::getRecordTitle('pages', $parentRecord)
: '';
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record);
$icon = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
$actions = $this->getRecordActions($row['tablename'], $row['recuid']);
$urlParameters = [
'edit' => [
......@@ -779,7 +779,7 @@ class ElementInformationController {
foreach ($rows as $row) {
$record = BackendUtility::getRecord($row['ref_table'], $row['ref_uid']);
if ($record) {
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record);
$icon = $this->iconFactory->getIconForRecord($row['tablename'], $record, Icon::SIZE_SMALL)->render();
$actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
$urlParameters = [
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
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\Utility\GeneralUtility;
......@@ -150,7 +149,7 @@ class MoveElementController {
// Get record for element:
$elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid);
// Headerline: Icon, record title:
$headerLine = IconUtility::getSpriteIconForRecord($this->table, $elRow, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($elRow, $this->table))));
$headerLine = '<span title="' . BackendUtility::getRecordIconAltText($elRow, $this->table) . '">' . $this->iconFactory->getIconForRecord($this->table, $elRow, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, TRUE);
// Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
$headerLine .= $this->doc->spacer(5);
......@@ -177,7 +176,7 @@ class MoveElementController {
if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int)$pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
$code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
$code .= $this->iconFactory->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
}
}
}
......@@ -201,7 +200,7 @@ class MoveElementController {
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
$posMap->cur_sys_language = $this->sys_language;
// Headerline for the parent page: Icon, record title:
$headerLine = IconUtility::getSpriteIconForRecord('pages', $pageInfo, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($pageInfo, 'pages'))));
$headerLine = '<span title="' . BackendUtility::getRecordIconAltText($pageInfo, 'pages') . '">' . $this->iconFactory->getIconForRecord('pages', $pageInfo, Icon::SIZE_SMALL)->render() . '</span>';
$headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, TRUE);
// Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
// SHARED page-TSconfig settings.
......@@ -227,7 +226,7 @@ class MoveElementController {
'moveUid' => $this->moveUid
))) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
$code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
$code .= $this->iconFactory->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
}
}
}
......@@ -270,7 +269,6 @@ class MoveElementController {
'csh' => '',
'back' => ''
);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
if ($this->page_id) {
if ((string)$this->table == 'pages') {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_pages');
......@@ -278,7 +276,7 @@ class MoveElementController {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'move_el_cs');
}
if ($this->R_URI) {
$buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $this->getLanguageService()->getLL('goBack', TRUE) . '">' . $iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL) . '</a>';
$buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $this->getLanguageService()->getLL('goBack', TRUE) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL) . '</a>';
}
}
return $buttons;
......
......@@ -268,7 +268,7 @@ class NewRecordController {
}
// Set header-HTML and return_url
if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
$iconImgTag = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo, array('title' => htmlspecialchars($this->pageinfo['_thePath'])));
$iconImgTag = '<span title="' . htmlspecialchars($this->pageinfo['_thePath']) . '">' . $this->iconFactory->getIconForRecord('pages', $this->pageinfo, Icon::SIZE_SMALL)->render() . '</span>';
$title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
} else {
$iconImgTag = '<span title="' . htmlspecialchars($this->pageinfo['_thePath']) . '">' . $this->iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL) . '</span>';
......@@ -402,14 +402,14 @@ class NewRecordController {
// New Page
$table = 'pages';
$v = $GLOBALS['TCA'][$table];
$pageIcon = IconUtility::getSpriteIconForRecord($table, array());
$pageIcon = $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render();
$newPageIcon = $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL);
$rowContent = '';
// New pages INSIDE this pages
$newPageLinks = array();
if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) {
// Create link to new page inside:
$newPageLinks[] = $this->linkWrap(IconUtility::getSpriteIconForRecord($table, array()) . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id);
$newPageLinks[] = $this->linkWrap($this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . $lang->sL($v['ctrl']['title'], TRUE) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', TRUE) . ')', $table, $this->id);
}
// New pages AFTER this pages
if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
......@@ -448,7 +448,7 @@ class NewRecordController {
&& (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1)
&& $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table)
) {
$newRecordIcon = IconUtility::getSpriteIconForRecord($table, array());
$newRecordIcon = $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render();
$rowContent = '';
$thisTitle = '';
// Create new link for record:
......
......@@ -18,25 +18,24 @@ use TYPO3\CMS\Backend\Form\Element\InlineElementHookInterface;
use TYPO3\CMS\Backend\Form\Exception\AccessDeniedContentEditException;
use TYPO3\CMS\Backend\Form\FormDataCompiler;
use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\InlineRelatedRecordResolver;
/**
* Render a single inline record relation.
......@@ -422,15 +421,7 @@ class InlineRecordContainer extends AbstractContainer {
$altText = BackendUtility::getRecordIconAltText($rec, $foreign_table);
// @todo: Hack for getSpriteIconForRecord
$recordForIconUtility = $rec;
if (isset($GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']) && is_array($rec[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']])) {
$recordForIconUtility[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']] = implode(
',',
$rec[$GLOBALS['TCA'][$foreign_table]['ctrl']['typeicon_column']]
);
}
$iconImg = IconUtility::getSpriteIconForRecord($foreign_table, $recordForIconUtility, array('title' => htmlspecialchars($altText), 'id' => $objectId . '_icon'));
$iconImg = '<span title="' . $altText . '" id="' . htmlspecialchars($objectId) . '_icon' . '">' . $this->iconFactory->getIconForRecord($foreign_table, $rec, Icon::SIZE_SMALL)->render() . '</span>';
$label = '<span id="' . $objectId . '_label">' . $recTitle . '</span>';
$ctrl = $this->renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
$thumbnail = FALSE;
......@@ -458,10 +449,10 @@ class InlineRecordContainer extends AbstractContainer {
if ($processedImage->getProperty('width')) {
$imageUrl = $processedImage->getPublicUrl(TRUE);
$thumbnail = '<img src="' . $imageUrl . '" ' .
'width="' . $processedImage->getProperty('width') . '" ' .
'height="' . $processedImage->getProperty('height') . '" ' .
'alt="' . htmlspecialchars($altText) . '" ' .
'title="' . htmlspecialchars($altText) . '">';
'width="' . $processedImage->getProperty('width') . '" ' .
'height="' . $processedImage->getProperty('height') . '" ' .
'alt="' . htmlspecialchars($altText) . '" ' .
'title="' . htmlspecialchars($altText) . '">';
}
}
}
......@@ -543,7 +534,7 @@ class InlineRecordContainer extends AbstractContainer {
}
$cells['info'] = '
<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($uid) . '); return false;')) . '" title="' . $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:showInfo', TRUE) . '">
' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '
</a>';
}
// If the table is NOT a read-only table, then show these links:
......@@ -558,7 +549,7 @@ class InlineRecordContainer extends AbstractContainer {
}
$cells['new'] = '
<a class="btn btn-default inlineNewButton ' . $this->inlineData['config'][$nameObject]['md5'] . '" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:new' . ($isPagesTable ? 'Page' : 'Record')), TRUE) . '" ' . $style . '>
' . $this->iconFactory->getIcon('actions-' . ($isPagesTable ? 'page' : 'document') . '-new', Icon::SIZE_SMALL)->render() . '
' . $this->iconFactory->getIcon('actions-' . ($isPagesTable ? 'page' : 'document') . '-new', Icon::SIZE_SMALL)->render() . '
</a>';
}
}
......@@ -596,8 +587,8 @@ class InlineRecordContainer extends AbstractContainer {
));
$editOnClick = 'if (top.content.list_frame) {' .
'top.content.list_frame.location.href=' .
GeneralUtility::quoteJSvalue($url . '&returnUrl=') .
'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search)' .
GeneralUtility::quoteJSvalue($url . '&returnUrl=') .
'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search)' .
';' .
'}';
$title = $languageService->sL('LLL:EXT:lang/locallang_core.xlf:cm.editMetadata');
......@@ -610,7 +601,8 @@ class InlineRecordContainer extends AbstractContainer {
// "Delete" link:
if ($enabledControls['delete'] && ($isPagesTable && $localCalcPerms & Permission::PAGE_DELETE
|| !$isPagesTable && $calcPerms & Permission::CONTENT_EDIT
|| $isSysFileReferenceTable && $calcPerms & Permission::PAGE_EDIT)) {
|| $isSysFileReferenceTable && $calcPerms & Permission::PAGE_EDIT)
) {
$onClick = htmlspecialchars(('if (confirm('
. GeneralUtility::quoteJSvalue($languageService->getLL('deleteWarning')) . ')) { '
. 'inline.deleteRecord(' . GeneralUtility::quoteJSvalue($nameObjectFtId) . ');'
......@@ -630,15 +622,15 @@ class InlineRecordContainer extends AbstractContainer {
$title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:unHide' . ($isPagesTable ? 'Page' : '')), TRUE);
$cells['hide.unhide'] = '
<a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL) . '
</a>';
} else {
$title = $languageService->sL(('LLL:EXT:lang/locallang_mod_web_list.xlf:hide' . ($isPagesTable ? 'Page' : '')), TRUE);
$cells['hide.hide'] = '
<a class="btn btn-default hiddenHandle ' . $className . '" href="#" onclick="'
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '
. htmlspecialchars($onClick) . '"' . 'title="' . $title . '">' .
$this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL) . '
</a>';
}
}
......@@ -747,7 +739,7 @@ class InlineRecordContainer extends AbstractContainer {
}
// Check internals regarding access
$isRootLevelRestrictionIgnored = BackendUtility::isRootLevelRestrictionIgnored($table);
if ($hasAccess|| (int)$calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) {
if ($hasAccess || (int)$calcPRec['pid'] === 0 && $isRootLevelRestrictionIgnored) {
$hasAccess = (bool)$backendUser->recordEditAccessInternals($table, $calcPRec);
}
}
......
......@@ -16,11 +16,12 @@ namespace TYPO3\CMS\Backend\Form\Container;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
/**
* Render header and footer row.
......@@ -61,15 +62,8 @@ class OuterWrapContainer extends AbstractContainer {
$recordPath = BackendUtility::getRecordPath($this->data['effectivePid'], $permissionsClause, 15);
}
// @todo: Hack for getSpriteIconForRecord
$recordForIconUtility = $row;
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) && is_array($row[$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']])) {
$recordForIconUtility[$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']] = implode(
',',
$row[$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']]
);
}
$icon = IconUtility::getSpriteIconForRecord($table, $recordForIconUtility, array('title' => $recordPath));
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$icon = '<span title="' . htmlspecialchars($recordPath) . '">' . $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
// @todo: Could this be done in a more clever way? Does it work at all?
$tableTitle = $languageService->sL($this->data['processedTca']['ctrl']['title']);
......
......@@ -259,7 +259,7 @@ class GroupElement extends AbstractFormElement {
$allowedTables[] = array(
// @todo: access to globals!
'name' => htmlspecialchars($languageService->sL($GLOBALS['TCA'][$allowedTable]['ctrl']['title'])),
'icon' => IconUtility::getSpriteIconForRecord($allowedTable, array()),
'icon' => $this->iconFactory->getIconForRecord($allowedTable, array(), Icon::SIZE_SMALL)->render(),
'onClick' => 'setFormValueOpenBrowser(\'db\', ' . GeneralUtility::quoteJSvalue($parameterArray['itemFormElName'] . '|||' . $allowedTable) . '); return false;'
);
}
......@@ -282,7 +282,7 @@ class GroupElement extends AbstractFormElement {
$rr = BackendUtility::getRecordWSOL($this_table, $this_uid);
$thumbnails[] = array(
'name' => BackendUtility::getRecordTitle($this_table, $rr, TRUE),
'image' => IconUtility::getSpriteIconForRecord($this_table, $rr),
'image' => $this->iconFactory->getIconForRecord($this_table, $rr, Icon::SIZE_SMALL)->render(),
'path' => BackendUtility::getRecordPath($rr['pid'], $perms_clause, 15),
'uid' => $rr['uid'],
'table' => $this_table
......
......@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Backend\Form\Wizard;
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\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
......@@ -147,6 +149,7 @@ class SuggestWizardDefaultReceiver {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, $this->selectClause, '', $this->orderByStatement, $start . ', 50');
$allRowsCount = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
if ($allRowsCount) {
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// check if we already have collected the maximum number of records
if (count($rows) > $this->maxItems) {
......@@ -158,9 +161,7 @@ class SuggestWizardDefaultReceiver {
if (!$this->checkRecordAccess($row, $row['uid'])) {
continue;
}
$spriteIcon = IconUtility::getSpriteIconForRecord(
$this->table, $row, array('style' => 'margin: 0 4px 0 -20px; padding: 0;')
);
$spriteIcon = $iconFactory->getIconForRecord($this->table, $row, Icon::SIZE_SMALL)->render();
$uid = $row['t3ver_oid'] > 0 ? $row['t3ver_oid'] : $row['uid'];
$path = $this->getRecordPath($row, $uid);
if (strlen($path) > 30) {
......@@ -331,11 +332,12 @@ class SuggestWizardDefaultReceiver {
*
* @param array $row The record to get the icon for
* @return string The path to the icon
* @deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8, use IconUtility::getSpriteIconForRecord() directly
* @deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8, use IconFactory::getIconForRecord() directly
*/
protected function getIcon($row) {
GeneralUtility::logDeprecatedFunction();
return IconUtility::getSpriteIconForRecord($this->mmForeignTable ?: $this->table, $row);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
return $iconFactory->getIconForRecord($this->mmForeignTable ?: $this->table, $row, Icon::SIZE_SMALL)->render();
}
/**
......
......@@ -109,7 +109,7 @@ class ElementBrowserRecordList extends DatabaseRecordList {
$code = BackendUtility::getRecordTitlePrep($code, $this->fixedL);
}
$title = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
$ficon = IconUtility::getSpriteIconForRecord($table, $row);
$ficon = $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render();
$aOnClick = 'return insertElement(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($row['uid']) . ', \'db\', ' . GeneralUtility::quoteJSvalue($title) . ', \'\', \'\', ' . GeneralUtility::quoteJSvalue($ficon) . ');';
$ATag = '<a href="#" onclick="' . $aOnClick . '" title="' . $this->getLanguageService()->getLL('addToList', TRUE) . '">';
$ATag_alt = substr($ATag, 0, -4) . ',\'\',1);">';
......
......@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Backend\Search\LiveSearch;
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\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
......@@ -196,7 +198,6 @@ class LiveSearch {
* @param string $orderBy
* @param string $limit MySql Limit notation
* @return array
* @see \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord()
* @see getTitleFromCurrentRow()
* @see getEditLink()
*/
......@@ -212,12 +213,14 @@ class LiveSearch {
);
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$title = 'id=' . $row['uid'] . ', pid=' . $row['pid'];
$collect[] = array(
'id' => $tableName . ':' . $row['uid'],
'pageId' => $tableName === 'pages' ? $row['uid'] : $row['pid'],
'typeLabel' => $this->getTitleOfCurrentRecordType($tableName),
'iconHTML' => IconUtility::getSpriteIconForRecord($tableName, $row, array('title' => 'id=' . $row['uid'] . ', pid=' . $row['pid'])),
'iconHTML' => '<span title="' . htmlspecialchars($title) . '">' . $iconFactory->getIconForRecord($tableName, $row, Icon::SIZE_SMALL)->render() . '</span>',
'title' => BackendUtility::getRecordTitle($tableName, $row),
'editLink' => $this->getEditLink($tableName, $row)
);
......
......@@ -595,7 +595,7 @@ function jumpToUrl(URL) {
public function getHeader($table, $row, $path, $noViewPageIcon = FALSE, $tWrap = array('', ''), $enableClickMenu = TRUE) {
$viewPage = '';
if (is_array($row) && $row['uid']) {
$iconImgTag = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($path)));
$iconImgTag = '<span title="' . htmlspecialchars($path) . '">' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
$title = strip_tags(BackendUtility::getRecordTitle($table, $row));
$viewPage = $noViewPageIcon ? '' : $this->viewPageIcon($row['uid']);
} else {
......@@ -1857,7 +1857,7 @@ function jumpToUrl(URL) {
// If there IS a real page
if (is_array($pageRecord) && $pageRecord['uid']) {
$alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
$iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => $alttext));
$iconImg = '<span title="' . htmlspecialchars($alttext) . '">' . $this->iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
// Make Icon:
$theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
$uid = $pageRecord['uid'];
......
......@@ -345,7 +345,8 @@ class Commands {
$subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat);
$subNode->setQTip($qtip);
if ((int)$record['uid'] !== 0) {
$spriteIconCode = IconUtility::getSpriteIconForRecord('pages', $record);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$spriteIconCode = $iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL)->render();
} else {
$spriteIconCode = $iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render();
}
......
......@@ -632,9 +632,9 @@ abstract class AbstractTreeView {
if (is_int($row)) {
$row = BackendUtility::getRecord($this->table, $row);
}