Commit 77bf6762 authored by Frank Nägler's avatar Frank Nägler Committed by Christian Kuhn
Browse files

[!!!][TASK] Deprecate IconUtility

Deprecate the IconUtility class from EXT:backend and handle its calls
using the new IconFactory from EXT:core.

Kudos to Benjamin Kott, Stephan Großberndt, Andreas Fernandez
and Frans Saris for the great support on this big project.

Resolves: #69057
Releases: master
Change-Id: I27a045b7a3b9d31e6e3e915e1452d44af56b0cee
Reviewed-on: http://review.typo3.org/42613

Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Benjamin Kott's avatarBenjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott's avatarBenjamin Kott <info@bk2k.info>
Reviewed-by: Stephan Großberndt's avatarStephan Großberndt <stephan@grossberndt.de>
Tested-by: Stephan Großberndt's avatarStephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 3a72c37f
......@@ -148,6 +148,10 @@
color: @gray;
}
.icon-status-dialog-information {
color: @brand-info;
}
.icon-status-dialog-ok,
.icon-status-status-permission-granted {
color: @brand-success;
......
......@@ -342,7 +342,9 @@
}
#typo3-pagetree-topPanel-filterWrap .t3-icon-input-clear {
right: 2px;
position: absolute;
right: 6px;
top: 3px;
}
#typo3-pagetree-topPanel-defaultPanel {
......
//
// Boostrap Slider
// Bootstrap Slider
//
// This is a custom less implementation for the value slider in the backend
// based on https://github.com/seiyria/bootstrap-slider
......@@ -261,4 +261,4 @@
.slider-track {
cursor: not-allowed;
}
}
\ No newline at end of file
}
......@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Backend\Backend\Avatar;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Service\DependencyOrderingService;
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface;
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;
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Backend\ToolbarItems;
use TYPO3\CMS\Backend\Module\ModuleLoader;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Database\PreparedStatement;
use TYPO3\CMS\Core\Http\AjaxRequestHandler;
use TYPO3\CMS\Core\Imaging\Icon;
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\ClickMenu;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Clipboard;
*/
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\Resource\ResourceFactory;
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Configuration;
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Lang\LanguageService;
......
......@@ -18,7 +18,6 @@ use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
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\Page\PageRenderer;
......
......@@ -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\Resource\Folder;
......
......@@ -17,11 +17,12 @@ 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\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
/**
* Script Class for the New Content element wizard
......@@ -116,6 +117,11 @@ class NewContentElementController {
*/
protected $MCONF;
/**
* @var IconFactory
*/
protected $iconFactory;
/**
* Constructor
*/
......@@ -158,6 +164,8 @@ class NewContentElementController {
$perms_clause = $this->getBackendUser()->getPagePermsClause(1);
$this->pageInfo = BackendUtility::readPageAccess($this->id, $perms_clause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
}
/**
......@@ -228,6 +236,9 @@ class NewContentElementController {
top.TYPO3ModuleMenu.refreshMenu();
}
');
$iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
// Traverse items for the wizard.
// An item is either a header or an item rendered with a radio button and title/description and icon:
$cc = ($key = 0);
......@@ -252,19 +263,31 @@ class NewContentElementController {
$aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent?"window.location.hash='#sel2';":'');
}
$icon = $wInfo['icon'];
if (strpos($wInfo['icon'], '..') === FALSE && !GeneralUtility::isAbsPath($icon)) {
$icon = GeneralUtility::getFileAbsFileName($icon, TRUE, TRUE);
$pathInfo = PathUtility::pathinfo($icon);
$path = PathUtility::getRelativePathTo($pathInfo['dirname']);
$icon = $path . $pathInfo['basename'];
if (isset($wInfo['icon'])) {
GeneralUtility::deprecationLog('The PageTS-Config: mod.wizards.newContentElement.wizardItems.*.elements.*.icon'
. ' is deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8.'
. ' Register your icon in IconRegistry::registerIcon and use the new setting:'
. ' mod.wizards.newContentElement.wizardItems.*.elements.*.iconIdentifier'
);
$wInfo['iconIdentifier'] = 'content-' . $k;
$icon = $wInfo['icon'];
if (StringUtility::beginsWith($icon, '../typo3conf/ext/')) {
$icon = str_replace('../typo3conf/ext/', 'EXT:', $icon);
}
if (!StringUtility::beginsWith($icon, 'EXT:') && strpos($icon, '/') !== FALSE) {
$icon = TYPO3_mainDir . GeneralUtility::resolveBackPath($wInfo['icon']);
}
$iconRegistry->registerIcon($wInfo['iconIdentifier'], BitmapIconProvider::class, array(
'source' => $icon
));
}
$icon = $this->iconFactory->getIcon($wInfo['iconIdentifier']);
$menuItems[$key]['content'] .= '
<div class="media">
<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
' . $content . '
<div class="media-left">
<img' . IconUtility::skinImg('', $icon) . ' alt="" />
' . $icon . '
</div>
<div class="media-body">
<strong>' . htmlspecialchars($wInfo['title']) . '</strong>' .
......@@ -339,11 +362,10 @@ class NewContentElementController {
'csh' => '',
'back' => ''
);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
if ($this->id && $this->access) {
$buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'new_ce');
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;
......
......@@ -17,6 +17,8 @@ namespace TYPO3\CMS\Backend\Controller\File;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\AjaxRequestHandler;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -267,11 +269,12 @@ class FileController {
$thumbUrl = $processedFile->getPublicUrl(TRUE);
}
}
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$result = array_merge(
$result->toArray(),
array (
'date' => BackendUtility::date($result->getModificationTime()),
'iconClasses' => \TYPO3\CMS\Backend\Utility\IconUtility::mapFileExtensionToSpriteIconClass($result->getExtension()),
'icon' => $iconFactory->getIconForFileExtension($result->getExtension(), Icon::SIZE_SMALL)->render(),
'thumbUrl' => $thumbUrl
)
);
......
......@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Backend\Controller;
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\Database\DatabaseConnection;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
......
......@@ -22,7 +22,6 @@ use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
use TYPO3\CMS\Backend\Form\FormResultCompiler;
use TYPO3\CMS\Backend\Form\NodeFactory;
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\Page\PageRenderer;
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Backend\View\PageTreeView;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
......
......@@ -18,7 +18,6 @@ use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Imaging\Icon;
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Form\Element;
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider;
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
......
......@@ -18,10 +18,10 @@ use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
use TYPO3\CMS\Backend\Module\ModuleLoader;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
......@@ -141,8 +141,6 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
* @throws \UnexpectedValueException
*/
protected function addItemsFromSpecial(array $result, $fieldName, array $items) {
$languageService = $this->getLanguageService();
// Guard
if (empty($result['processedTca']['columns'][$fieldName]['config']['special'])
|| !is_string($result['processedTca']['columns'][$fieldName]['config']['special'])
......@@ -150,6 +148,9 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
return $items;
}
$languageService = $this->getLanguageService();
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$special = $result['processedTca']['columns'][$fieldName]['config']['special'];
if ($special === 'tables') {
foreach ($GLOBALS['TCA'] as $currentTable => $_) {
......@@ -158,7 +159,7 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
continue;
}
$label = !empty($GLOBALS['TCA'][$currentTable]['ctrl']['title']) ? $GLOBALS['TCA'][$currentTable]['ctrl']['title'] : '';
$icon = IconUtility::mapRecordTypeToSpriteIconName($currentTable, array());
$icon = $iconFactory->mapRecordTypeToIconIdentifier($currentTable, array());
$helpText = array();
$languageService->loadSingleTableDescription($currentTable);
// @todo: check if this actually works, currently help texts are missing
......@@ -180,7 +181,7 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
}
$label = $specialItem[0];
$value = $specialItem[1];
$icon = IconUtility::mapRecordTypeToSpriteIconName('pages', array('doktype' => $specialItem[1]));
$icon = $iconFactory->mapRecordTypeToIconIdentifier('pages', array('doktype' => $specialItem[1]));
$items[] = array($label, $value, $icon);
}
}
......@@ -193,7 +194,7 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
$theField = array_pop($theFieldParts);
// Add header if not yet set for table:
if (!array_key_exists($theTable, $items)) {
$icon = IconUtility::mapRecordTypeToSpriteIconName($theTable, array());
$icon = $iconFactory->mapRecordTypeToIconIdentifier($theTable, array());
$items[$theTable] = array(
$GLOBALS['TCA'][$theTable]['ctrl']['title'],
'--div--',
......@@ -422,6 +423,8 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
$iconPath = $result['processedTca']['ctrl']['selicon_field_path'];
}
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
while ($foreignRow = $database->sql_fetch_assoc($queryResource)) {
BackendUtility::workspaceOL($foreignTable, $foreignRow);
if (is_array($foreignRow)) {
......@@ -430,7 +433,7 @@ class TcaSelectItems extends AbstractItemProvider implements FormDataProviderInt
$iParts = GeneralUtility::trimExplode(',', $foreignRow[$iconFieldName], TRUE);
$icon = '../' . $iconPath . '/' . trim($iParts[0]);
} else {
$icon = IconUtility::mapRecordTypeToSpriteIconName($foreignTable, $foreignRow);
$icon = $iconFactory->mapRecordTypeToIconIdentifier($foreignTable, $foreignRow);
}
// Add the item
$items[] = array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment