041a41b156e4c45e9cb2a00636dc0a042cc262df
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3skin / Classes / Slot / IconStyleModifier.php
1 <?php
2 namespace TYPO3\CMS\T3skin\Slot;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Slot for IconUtility
19 */
20 class IconStyleModifier {
21
22 protected $flatSpriteIconName = array(
23 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-close' => 'fa-close',
24 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-export-csv' => 'fa-download',
25 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-export-t3d' => 'fa-download',
26 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-history-open' => 'fa-history',
27 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-import-t3d' => 'fa-upload',
28 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-edit-access' => 'fa-clock-o',
29 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-info' => 'fa-info-circle',
30 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-move c-inputButton' => 'fa-arrows',
31 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-move' => 'fa-arrows',
32 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new' => 'fa-plus-square',
33 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-open' => 'fa-pencil',
34 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-select' => 'fa-check-square-o',
35 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-view' => 'fa-desktop',
36 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-add' => 'fa-plus-circle',
37 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-copy' => 'fa-copy',
38 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-copy-release' => 'fa-copy danger',
39 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-cut' => 'fa-cut',
40 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-cut-release' => 'fa-cut danger',
41 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-delete' => 'fa-trash',
42 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-download' => 'fa-download',
43 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-edit' => 'fa-pencil',
44 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-hide' => 'fa-toggle-on',
45 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-paste' => 'fa-paste',
46 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-paste-after' => 'fa-clipboard',
47 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-pick-date' => 'fa-calendar',
48 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-rename' => 'fa-quote-right',
49 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-undo' => 'fa-undo',
50 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-unhide' => 'fa-toggle-off warning',
51 't3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-upload' => 'fa-upload',
52 't3-icon t3-icon-actions t3-icon-actions-input t3-icon-input-clear' => 'fa-times-circle',
53 // @todo t3-btn-* is still used in FormEngine.js refactor to use data attributes in HTML
54 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-down t3-btn t3-btn-moveoption-down' => 'fa-angle-down t3-btn t3-btn-moveoption-down',
55 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-to-bottom t3-btn t3-btn-moveoption-bottom' => 'fa-angle-double-down t3-btn t3-btn-moveoption-bottom',
56 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-to-bottom' => 'fa-angle-double-down',
57 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-down' => 'fa-angle-down',
58 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-left' => 'fa-angle-left',
59 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-right' => 'fa-angle-right',
60 // @todo t3-btn-* is still used in FormEngine.js refactor to use data attributes in HTML
61 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-to-top' => 'fa-angle-double-up',
62 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-to-top t3-btn t3-btn-moveoption-top' => 'fa-angle-double-up t3-btn t3-btn-moveoption-top',
63 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-up t3-btn t3-btn-moveoption-up' => 'fa-angle-up t3-btn t3-btn-moveoption-up',
64 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-up' => 'fa-angle-up',
65 't3-icon t3-icon-actions t3-icon-actions-page t3-icon-page-move' => 'fa-arrows',
66 't3-icon t3-icon-actions t3-icon-actions-page t3-icon-page-new' => 'fa-plus-square',
67 't3-icon t3-icon-actions t3-icon-actions-page t3-icon-page-open' => 'fa-pencil',
68 // @todo t3-btn-* is still used in FormEngine.js refactor to use data attributes in HTML
69 't3-icon t3-icon-actions t3-icon-actions-selection t3-icon-selection-delete t3-btn t3-btn-removeoption' => 'fa-times t3-btn t3-btn-removeoption',
70 't3-icon t3-icon-actions t3-icon-actions-selection t3-icon-selection-delete' => 'fa-remove',
71 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-backend-user-emulate' => 'fa-sign-in',
72 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-backend-user-switch' => 'fa-sign-out',
73 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-cache-clear' => 'fa-bolt',
74 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-configure' => 'fa-gear',
75 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-documentation' => 'fa-anchor',
76 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-download ' => 'fa-cloud-download',
77 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-download' => 'fa-download',
78 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-install' => 'fa-plus-circle',
79 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-sqldump' => 'fa-database',
80 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-update' => 'fa-refresh',
81 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-extension-uninstall' => 'fa-minus-square',
82 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-help-open' => 'fa-question-circle',
83 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-list-open' => 'fa-list-alt',
84 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-refresh' => 'fa-refresh',
85 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-shortcut-new' => 'fa-star',
86 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-tree-search-open' => 'fa-search',
87 't3-icon t3-icon-actions t3-icon-actions-template t3-icon-template-new' => 'fa-plus',
88 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-go-back' => 'fa-angle-double-left',
89 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-go-forward' => 'fa-angle-double-right',
90 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-go-up' => 'fa-level-up',
91 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-list-collapse collapseIcon' => 'fa-chevron-up',
92 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-list-expand collapseIcon' => 'fa-chevron-down',
93 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-paging-first' => 'fa-step-backward',
94 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-paging-last' => 'fa-step-forward',
95 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-paging-next' => 'fa-arrow-right',
96 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-paging-previous' => 'fa-arrow-left',
97 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-expand' => 'fa-chevron-right',
98 't3-icon t3-icon-actions t3-icon-actions-view t3-icon-view-table-collapse' => 'fa-chevron-left',
99 't3-icon t3-icon-actions t3-icon-actions-window t3-icon-window-open' => 'fa-arrows-alt',
100 't3-icon t3-icon-actions t3-icon-system-extension-import' => 'fa-cloud-download',
101 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-actions' => 'fa-cog',
102 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-cache' => 'fa-bolt',
103 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-opendocs' => 'fa-file',
104 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-search' => 'fa-search',
105 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-shortcut' => 'fa-star',
106 't3-icon t3-icon-apps t3-icon-apps-toolbar t3-icon-toolbar-menu-workspace' => 'fa-th-large',
107 't3-icon t3-icon-extensions t3-icon-extensions-extensionmanager t3-icon-extensionmanager-update-script' => 'fa-refresh',
108 't3-icon t3-icon-extensions t3-icon-extensions-scheduler t3-icon-scheduler-run-task' => 'fa-play-circle',
109 't3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf' => 'fa-file-pdf-o',
110 't3-icon t3-icon-mimetypes t3-icon-mimetypes-text t3-icon-text-html' => 'fa-file-text-o',
111 't3-icon t3-icon-mimetypes t3-icon-mimetypes-word t3-icon-word' => 'fa-file-word-o',
112 't3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-sys_language' => 'fa-globe',
113 't3-icon t3-icon-mimetypes t3-icon-mimetypes-text t3-icon-text-js' => 'fa-code',
114 't3-icon t3-icon-status t3-icon-status-dialog t3-icon-dialog-error' => 'fa-exclamation-triangle',
115 't3-icon t3-icon-status t3-icon-status-dialog t3-icon-dialog-information' => 'fa-info-circle',
116 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-locked' => 'fa-lock',
117 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-permission-denied' => 'fa-times',
118 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-permission-granted' => 'fa-check',
119 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-readonly' => 'fa-lock',
120 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-sorting-light-asc' => 'fa-angle-up',
121 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-sorting-light-desc' => 'fa-angle-down',
122 't3-icon t3-icon-status t3-icon-status-warning t3-icon-warning-lock' => 'fa-lock',
123 't3-icon t3-icon-status t3-icon-status-status t3-icon-status-checked' => 'fa-check',
124 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-move sortableHandle' => 'fa-reorder sortableHandle',
125 't3-icon t3-icon-actions t3-icon-actions-move t3-icon-move-move' => 'fa-reorder',
126 't3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-paste-into' => 'fa-clipboard',
127 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-options-view' => 'fa-list-alt'
128 );
129
130 /**
131 * Hook to manipulate IconUtility html output code
132 *
133 * @param array $tagAttributes
134 * @param null $innerHtml
135 * @param null $tagName
136 * @return array
137 */
138 public function buildSpriteHtmlIconTag(array $tagAttributes, $innerHtml, $tagName) {
139 $class = !empty($this->flatSpriteIconName[$tagAttributes['class']]) ? $this->flatSpriteIconName[$tagAttributes['class']] : NULL;
140 if ($class !== NULL) {
141 $tagAttributes['class'] = 't3-icon fa ' . $class;
142 }
143
144 return array($tagAttributes, $innerHtml, $tagName);
145 }
146
147 /**
148 * returns the old class name if modified, otherwise the replaced fa icon
149 *
150 * @param string $iconName
151 * @param string $cssClasses
152 * @return string
153 */
154 public function buildSpriteIconClasses($iconName, &$cssClasses) {
155 if (isset($this->flatSpriteIconName[$cssClasses])) {
156 $cssClasses = 't3-icon fa ' . $this->flatSpriteIconName[$cssClasses];
157 }
158 }
159
160 }