Commit f4de6926 authored by Patricia Tiedemann's avatar Patricia Tiedemann Committed by Andreas Fernandez
Browse files

[TASK] Render backend icon list by existing files

Until now all of the backend icons were a manually edited array of file
paths. With this patch defined icon folders in the core are scanned
for existing icon files and build most of that static array
automatically.

For historic reason (and hopefully soon to be removed alltogether) a
second array of statically declared icons is added and merged into.

Some icons that were in the original static list but whose files
actually are missing or misnamed are marked as deprecated.

Resolves: #82348
Releases: master
Change-Id: I8dc4fbbe815d923eda55e1c1b072369e62f66d87
Reviewed-on: https://review.typo3.org/54020

Reviewed-by: Benjamin Kott's avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benjamin Kott's avatarBenjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
parent a9f7ec32
......@@ -17,7 +17,7 @@
"@types/jqueryui": "^1.11.34",
"@types/nprogress": "*",
"@types/requirejs": "*",
"@typo3/icons": "^1.4.1",
"@typo3/icons": "^1.5.1",
"autoprefixer": "^6.3.7",
"autosize": "^3.0.21",
"bootstrap-sass": "^3.3.7",
......
......@@ -582,7 +582,7 @@ class InlineRecordContainer extends AbstractContainer
if ($lockInfo = BackendUtility::isRecordLocked($foreignTable, $rec['uid'])) {
$cells['locked'] = '
<a class="btn btn-default" href="#" data-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">
' . '<span title="' . htmlspecialchars($lockInfo['msg']) . '">' . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</span>' . '
' . '<span title="' . htmlspecialchars($lockInfo['msg']) . '">' . $this->iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</span>' . '
</a>';
}
// Hook: Post-processing of single controls for specific child records:
......
......@@ -345,7 +345,7 @@ class Commands
$lockInfo = BackendUtility::isRecordLocked('pages', $record['uid']);
if (is_array($lockInfo)) {
$qtip .= '<br />' . htmlspecialchars($lockInfo['msg']);
$prefix .= '<span class="typo3-pagetree-status">' . $iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</span>';
$prefix .= '<span class="typo3-pagetree-status">' . $iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</span>';
}
// Call stats information hook
$stat = '';
......
......@@ -2027,7 +2027,7 @@ class PageLayoutView
// Get record locking status:
if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
$additionalIcons[] = '<a href="#" data-toggle="tooltip" data-title="' . htmlspecialchars($lockInfo['msg']) . '">'
. $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
. $this->iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
}
// Call stats information hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
......@@ -2792,7 +2792,7 @@ class PageLayoutView
public function noEditIcon($label = 'noEditItems')
{
$title = htmlspecialchars($this->getLanguageService()->getLL($label));
return '<span title="' . $title . '">' . $this->iconFactory->getIcon('status-status-edit-read-only', Icon::SIZE_SMALL)->render() . '</span>';
return '<span title="' . $title . '">' . $this->iconFactory->getIcon('status-edit-read-only', Icon::SIZE_SMALL)->render() . '</span>';
}
/*****************************************
......
......@@ -61,7 +61,7 @@ class PageTreeView extends BrowseTreeView
if ($lockInfo = BackendUtility::isRecordLocked('pages', $row['uid'])) {
$aOnClick = 'alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;';
$lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">'
. '<span title="' . htmlspecialchars($lockInfo['msg']) . '">' . $iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</span></a>';
. '<span title="' . htmlspecialchars($lockInfo['msg']) . '">' . $iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</span></a>';
} else {
$lockIcon = '';
}
......
......@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Imaging;
* The TYPO3 project - inspiring people to share!
*/
use Symfony\Component\Finder\Finder;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
use TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider;
......@@ -48,12 +50,47 @@ class IconRegistry implements SingletonInterface
*/
protected $moduleIconsInitialized = false;
/**
* @var bool
*/
protected $backendIconsInitialized = false;
/**
* Registered icons
*
* @var array
*/
protected $icons = [
protected $icons = [];
/**
* Paths to backend icon folders for automatic registration
*
* @var string[]
*/
protected $backendIconPaths = [
'EXT:backend/Resources/Public/Icons/',
'EXT:core/Resources/Public/Icons/T3Icons/',
'EXT:impexp/Resources/Public/Icons/',
'EXT:install/Resources/Public/Icons'
];
/**
* List of allowed icon file extensions with their Provider class
*
* @var string[]
*/
protected $backendIconAllowedExtensionsWithProvider = [
'png' => BitmapIconProvider::class,
'svg' => SvgIconProvider::class
];
/**
* manually registered icons
* hopefully obsolete one day
*
* @var array
*/
protected $staticIcons = [
/**
* Important Information:
......@@ -63,2283 +100,24 @@ class IconRegistry implements SingletonInterface
*/
// Actions
'actions-add' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-add.svg'
]
],
'actions-check' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-check.svg'
]
],
'actions-close' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-close.svg'
]
],
'actions-cloud' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-cloud.svg'
]
],
'actions-database-export' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-database-export.svg'
]
],
'actions-database-import' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-database-import.svg'
]
],
'actions-database-reload' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-database-reload.svg'
]
],
'actions-database' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-database.svg'
]
],
'actions-delete' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-delete.svg'
]
],
'actions-document-duplicates-select' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-duplicates-select.svg'
]
],
'actions-document-edit-access' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-edit-access.svg'
]
],
'actions-document-export-csv' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-export-csv.svg'
]
],
'actions-document-export-t3d' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-export-t3d.svg'
]
],
'actions-document-history-open' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-history-open.svg'
]
],
'actions-document-import-t3d' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-import-t3d.svg'
]
],
'actions-document-info' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-info.svg'
]
],
'actions-document-localize' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-localize.svg'
]
],
'actions-document-move' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-move.svg'
]
],
'actions-document-new' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-new.svg'
]
],
'actions-document-open-read-only' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-open-read-only.svg'
]
],
'actions-document-open' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-open.svg'
]
],
'actions-document-paste-after' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-paste-after.svg'
]
],
'actions-document-paste-before' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-paste-before.svg'
]
],
'actions-document-paste-into' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-paste-into.svg'
]
],
'actions-document-paste' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-paste.svg'
]
],
'actions-document-save-cleartranslationcache' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save-cleartranslationcache.svg'
]
],
'actions-document-save-close' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save-close.svg'
]
],
'actions-document-save-new' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save-new.svg'
]
],
'actions-document-save-translation' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save-translation.svg'
]
],
'actions-document-save-view' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save-view.svg'
]
],
'actions-document-save' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-save.svg'
]
],
'actions-document-select' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-select.svg'
]
],
'actions-document-synchronize' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-synchronize.svg'
]
],
'actions-document-view' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document-view.svg'
]
],
'actions-document' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-document.svg'
]
],
'actions-download' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-download.svg'
]
],
'actions-duplicates' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-duplicates.svg'
]
],
'actions-edit-copy-release' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-copy-release.svg'
]
],
'actions-edit-copy' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-copy.svg'
]
],
'actions-edit-cut-release' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-cut-release.svg'
]
],
'actions-edit-cut' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-cut.svg'
]
],
'actions-edit-delete' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-delete.svg'
]
],
'actions-edit-download' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-download.svg'
]
],
'actions-device-desktop' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-device-desktop.svg'
]
],
'actions-device-mobile' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-device-mobile.svg'
]
],
'actions-device-orientation-change' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-device-orientation-change.svg'
]
],
'actions-device-tablet' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-device-tablet.svg'
]
],
'actions-device-unidentified' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-device-tablet.svg'
]
],
'actions-edit-hide' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-hide.svg'
]
],
'actions-edit-insert-default' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-insert-default.svg'
]
],
'actions-edit-localize-status-high' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-localize-status-high.svg'
]
],
'actions-edit-localize-status-low' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-localize-status-low.svg'
]
],
'actions-edit-merge-localization' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-merge-localization.svg'
]
],
'actions-edit-pick-date' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-pick-date.svg'
]
],
'actions-edit-rename' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-rename.svg'
]
],
'actions-edit-replace' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-replace.svg'
]
],
'actions-edit-restore' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-restore.svg'
]
],
'actions-edit-undelete-edit' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-undelete-edit.svg'
]
],
'actions-edit-undo' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-undo.svg'
]
],
'actions-edit-unhide' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-unhide.svg'
]
],
'actions-edit-upload' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-edit-upload.svg'
]
],
'actions-expand' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-expand.svg'
]
],
'actions-file-csv' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-file-csv.svg'
]
],
'actions-file-html' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-file-html.svg'
]
],
'actions-file-openoffice' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-file-openoffice.svg'
]
],
'actions-file-pdf' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-file-pdf.svg'
]
],
'actions-file' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-file.svg'
]
],
'actions-filter' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-filter.svg'
]
],
'actions-folder' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-folder.svg'
]
],
'actions-fullscreen' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-fullscreen.svg'
]
],
'actions-input-clear' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-input-clear.svg'
]
],
'actions-insert-record' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-insert-record.svg'
]
],
'actions-insert-reference' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-insert-reference.svg'
]
],
'actions-localize' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-localize.svg'
]
],
'actions-lock' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-lock.svg'
]
],
'actions-logout' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-logout.svg'
]
],
'actions-markstate' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-markstate.svg'
]
],
'actions-menu' => [
'provider' => SvgIconProvider::class,
'options' => [
'source' => 'EXT:core/Resources/Public/Icons/T3Icons/actions/actions-menu.svg'
]
],
'actions-merge' => [
'provider' => SvgIconProvider::class,
'options' => [