[TASK] Replace sprite icon "actions-view-table-*" with the new IconFactory
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Imaging / IconRegistry.php
1 <?php
2 namespace TYPO3\CMS\Core\Imaging;
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 use TYPO3\CMS\Core\Exception;
18 use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;
19 use TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider;
20 use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
21
22 /**
23 * Class IconRegistry, which makes it possible to register custom icons
24 * from within an extension.
25 */
26 class IconRegistry implements \TYPO3\CMS\Core\SingletonInterface {
27
28 /**
29 * Registered icons
30 *
31 * @var array
32 */
33 protected $icons = array(
34 // Default icon, fallback
35 'default-not-found' => array(
36 'provider' => FontawesomeIconProvider::class,
37 'options' => array(
38 'name' => 'times-circle',
39 )
40 ),
41
42 // Action icons
43 'apps-filetree-folder-default' => array(
44 'provider' => BitmapIconProvider::class,
45 'options' => array(
46 'source' => 'EXT:t3skin/images/icons/apps/filetree-folder-default.png',
47 )
48 ),
49 'apps-filetree-root' => array(
50 'provider' => BitmapIconProvider::class,
51 'options' => array(
52 'source' => 't3skin/images/icons/apps/filetree-root.png',
53 )
54 ),
55 'apps-toolbar-menu-cache' => array(
56 'provider' => FontawesomeIconProvider::class,
57 'options' => array(
58 'name' => 'bolt',
59 )
60 ),
61 'apps-toolbar-menu-shortcut' => array(
62 'provider' => FontawesomeIconProvider::class,
63 'options' => array(
64 'name' => 'star',
65 )
66 ),
67 'apps-toolbar-menu-workspace' => array(
68 'provider' => FontawesomeIconProvider::class,
69 'options' => array(
70 'name' => 'th-large',
71 )
72 ),
73 'apps-pagetree-page-domain' => array(
74 'provider' => BitmapIconProvider::class,
75 'options' => array(
76 'source' => 'EXT:t3skin/images/icons/apps/pagetree-page-domain.png',
77 )
78 ),
79 'apps-pagetree-page-default' => array(
80 'provider' => BitmapIconProvider::class,
81 'options' => array(
82 'source' => 'EXT:t3skin/images/icons/apps/pagetree-page-default.png',
83 )
84 ),
85 'apps-pagetree-root' => array(
86 'provider' => SvgIconProvider::class,
87 'options' => array(
88 'source' => 'EXT:backend/Resources/Public/Icons/App/apps-pagetree-root.svg',
89 )
90 ),
91 'apps-toolbar-menu-opendocs' => array(
92 'provider' => FontawesomeIconProvider::class,
93 'options' => array(
94 'name' => 'file',
95 )
96 ),
97 'apps-toolbar-menu-search' => array(
98 'provider' => SvgIconProvider::class,
99 'options' => array(
100 'source' => 'EXT:backend/Resources/Public/Icons/App/apps-toolbar-menu-search.svg',
101 )
102 ),
103 'actions-document-close' => array(
104 'provider' => FontawesomeIconProvider::class,
105 'options' => array(
106 'name' => 'close',
107 )
108 ),
109 'actions-actions-document-duplicates-select' => array(
110 'provider' => BitmapIconProvider::class,
111 'options' => array(
112 'source' => 'EXT:t3skin/images/icons/actions/document-duplicates-select.png',
113 )
114 ),
115 'actions-document-edit-access' => array(
116 'provider' => FontawesomeIconProvider::class,
117 'options' => array(
118 'name' => 'clock-o',
119 )
120 ),
121 'actions-document-export-t3d' => array(
122 'provider' => FontawesomeIconProvider::class,
123 'options' => array(
124 'name' => 'download',
125 )
126 ),
127 'actions-document-history-open' => array(
128 'provider' => FontawesomeIconProvider::class,
129 'options' => array(
130 'name' => 'history',
131 )
132 ),
133 'actions-document-info' => array(
134 'provider' => FontawesomeIconProvider::class,
135 'options' => array(
136 'name' => 'info-circle',
137 )
138 ),
139 'actions-document-import-t3d' => array(
140 'provider' => FontawesomeIconProvider::class,
141 'options' => array(
142 'name' => 'upload',
143 )
144 ),
145 'actions-document-localize' => array(
146 'provider' => BitmapIconProvider::class,
147 'options' => array(
148 'source' => 'EXT:t3skin/images/icons/actions/document-localize.png',
149 )
150 ),
151 'actions-document-move' => array(
152 'provider' => FontawesomeIconProvider::class,
153 'options' => array(
154 'name' => 'arrows',
155 )
156 ),
157 'actions-document-new' => array(
158 'provider' => FontawesomeIconProvider::class,
159 'options' => array(
160 'name' => 'plus-square',
161 )
162 ),
163 'actions-document-open' => array(
164 'provider' => FontawesomeIconProvider::class,
165 'options' => array(
166 'name' => 'pencil',
167 )
168 ),
169 'actions-document-paste' => array(
170 'provider' => SvgIconProvider::class,
171 'options' => array(
172 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-paste.svg',
173 )
174 ),
175 'actions-document-paste-after' => array(
176 'provider' => SvgIconProvider::class,
177 'options' => array(
178 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-paste-after.svg',
179 )
180 ),
181 'actions-document-paste-before' => array(
182 'provider' => SvgIconProvider::class,
183 'options' => array(
184 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-paste-before.svg',
185 )
186 ),
187 'actions-document-paste-into' => array(
188 'provider' => SvgIconProvider::class,
189 'options' => array(
190 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-paste-into.svg',
191 )
192 ),
193 'actions-document-select' => array(
194 'provider' => FontawesomeIconProvider::class,
195 'options' => array(
196 'name' => 'check-square-o',
197 )
198 ),
199 'actions-document-save' => array(
200 'provider' => SvgIconProvider::class,
201 'options' => array(
202 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save.svg',
203 )
204 ),
205 'actions-document-save-cleartranslationcache' => array(
206 'provider' => SvgIconProvider::class,
207 'options' => array(
208 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save-cleartranslationcache.svg',
209 )
210 ),
211 'actions-document-save-close' => array(
212 'provider' => SvgIconProvider::class,
213 'options' => array(
214 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save-close.svg',
215 )
216 ),
217 'actions-document-save-new' => array(
218 'provider' => SvgIconProvider::class,
219 'options' => array(
220 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save-new.svg',
221 )
222 ),
223 'actions-document-save-translation' => array(
224 'provider' => SvgIconProvider::class,
225 'options' => array(
226 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save-translation.svg',
227 )
228 ),
229 'actions-document-save-view' => array(
230 'provider' => SvgIconProvider::class,
231 'options' => array(
232 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-document-save-view.svg',
233 )
234 ),
235 'actions-document-synchronize' => array(
236 'provider' => BitmapIconProvider::class,
237 'options' => array(
238 'source' => 'EXT:t3skin/images/icons/actions/document-synchronize.png'
239 )
240 ),
241 'actions-document-view' => array(
242 'provider' => FontawesomeIconProvider::class,
243 'options' => array(
244 'name' => 'desktop',
245 )
246 ),
247 'actions-edit-copy' => array(
248 'provider' => FontawesomeIconProvider::class,
249 'options' => array(
250 'name' => 'copy',
251 )
252 ),
253 'actions-edit-copy-release' => array(
254 'provider' => FontawesomeIconProvider::class,
255 'options' => array(
256 'name' => 'copy',
257 )
258 ),
259 'actions-edit-cut' => array(
260 'provider' => FontawesomeIconProvider::class,
261 'options' => array(
262 'name' => 'scissors',
263 )
264 ),
265 'actions-edit-cut-release' => array(
266 'provider' => FontawesomeIconProvider::class,
267 'options' => array(
268 'name' => 'scissors',
269 )
270 ),
271 'actions-edit-download' => array(
272 'provider' => FontawesomeIconProvider::class,
273 'options' => array(
274 'name' => 'download',
275 )
276 ),
277 'actions-edit-add' => array(
278 'provider' => FontawesomeIconProvider::class,
279 'options' => array(
280 'name' => 'plus-circle',
281 )
282 ),
283 'actions-edit-delete' => array(
284 'provider' => FontawesomeIconProvider::class,
285 'options' => array(
286 'name' => 'trash',
287 )
288 ),
289 'actions-edit-localize-status-low' => array(
290 'provider' => BitmapIconProvider::class,
291 'options' => array(
292 'source' => 'EXT:t3skin/images/icons/actions/edit-localize-status-low.png',
293 )
294 ),
295 'actions-edit-localize-status-high' => array(
296 'provider' => BitmapIconProvider::class,
297 'options' => array(
298 'source' => 'EXT:t3skin/images/icons/actions/edit-localize-status-high.png',
299 )
300 ),
301 'actions-edit-merge-localization' => array(
302 'provider' => BitmapIconProvider::class,
303 'options' => array(
304 'source' => 'EXT:t3skin/images/icons/actions/edit-merge-localization.png',
305 )
306 ),
307 'actions-edit-pick-date' => array(
308 'provider' => FontawesomeIconProvider::class,
309 'options' => array(
310 'name' => 'calendar',
311 )
312 ),
313 'actions-edit-rename' => array(
314 'provider' => FontawesomeIconProvider::class,
315 'options' => array(
316 'name' => 'quote-right',
317 )
318 ),
319 'actions-edit-hide' => array(
320 'provider' => FontawesomeIconProvider::class,
321 'options' => array(
322 'name' => 'toggle-on',
323 )
324 ),
325 'actions-edit-replace' => array(
326 'provider' => FontawesomeIconProvider::class,
327 'options' => array(
328 'name' => 'retweet',
329 )
330 ),
331 'actions-edit-restore' => array(
332 'provider' => BitmapIconProvider::class,
333 'options' => array(
334 'source' => 'EXT:t3skin/images/icons/actions/edit-restore.png',
335 )
336 ),
337 'actions-edit-undo' => array(
338 'provider' => FontawesomeIconProvider::class,
339 'options' => array(
340 'name' => 'undo',
341 )
342 ),
343 'actions-edit-unhide' => array(
344 'provider' => FontawesomeIconProvider::class,
345 'options' => array(
346 'name' => 'toggle-off',
347 )
348 ),
349 'actions-edit-upload' => array(
350 'provider' => FontawesomeIconProvider::class,
351 'options' => array(
352 'name' => 'upload',
353 )
354 ),
355 'actions-filter' => array(
356 'provider' => SvgIconProvider::class,
357 'options' => array(
358 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-filter.svg',
359 )
360 ),
361 'actions-insert-record' => array(
362 'provider' => BitmapIconProvider::class,
363 'options' => array(
364 'source' => 'EXT:t3skin/images/icons/actions/insert-record.png',
365 )
366 ),
367 'actions-insert-reference' => array(
368 'provider' => BitmapIconProvider::class,
369 'options' => array(
370 'source' => 'EXT:t3skin/images/icons/actions/insert-reference.png',
371 )
372 ),
373 'actions-markstate' => array(
374 'provider' => FontawesomeIconProvider::class,
375 'options' => array(
376 'name' => 'square-o',
377 )
378 ),
379 'actions-page-new' => array(
380 'provider' => SvgIconProvider::class,
381 'options' => array(
382 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-page-new.svg',
383 )
384 ),
385 'actions-page-move' => array(
386 'provider' => SvgIconProvider::class,
387 'options' => array(
388 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-page-move.svg',
389 ),
390 ),
391 'actions-move' => array(
392 'provider' => FontawesomeIconProvider::class,
393 'options' => array(
394 'name' => 'arrows',
395 )
396 ),
397 'actions-move-down' => array(
398 'provider' => FontawesomeIconProvider::class,
399 'options' => array(
400 'name' => 'angle-down',
401 )
402 ),
403 'actions-move-left' => array(
404 'provider' => FontawesomeIconProvider::class,
405 'options' => array(
406 'name' => 'angle-left',
407 )
408 ),
409 'actions-move-move' => array(
410 'provider' => FontawesomeIconProvider::class,
411 'options' => array(
412 'name' => 'bars',
413 )
414 ),
415 'actions-move-right' => array(
416 'provider' => FontawesomeIconProvider::class,
417 'options' => array(
418 'name' => 'angle-right',
419 )
420 ),
421 'actions-move-to-bottom' => array(
422 'provider' => FontawesomeIconProvider::class,
423 'options' => array(
424 'name' => 'angle-double-down',
425 )
426 ),
427 'actions-move-to-top' => array(
428 'provider' => FontawesomeIconProvider::class,
429 'options' => array(
430 'name' => 'angle-double-up',
431 )
432 ),
433 'actions-move-up' => array(
434 'provider' => FontawesomeIconProvider::class,
435 'options' => array(
436 'name' => 'angle-up',
437 )
438 ),
439 'actions-page-open' => array(
440 'provider' => SvgIconProvider::class,
441 'options' => array(
442 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-page-open.svg',
443 )
444 ),
445 'actions-pagetree-collapse' => array(
446 'provider' => FontawesomeIconProvider::class,
447 'options' => array(
448 'name' => 'caret-right',
449 )
450 ),
451 'actions-pagetree-expand' => array(
452 'provider' => FontawesomeIconProvider::class,
453 'options' => array(
454 'name' => 'caret-down',
455 )
456 ),
457 'actions-pagetree-mountroot' => array(
458 'provider' => FontawesomeIconProvider::class,
459 'options' => array(
460 'name' => 'anchor',
461 )
462 ),
463 'actions-selection-delete' => array(
464 'provider' => FontawesomeIconProvider::class,
465 'options' => array(
466 'name' => 'trash',
467 )
468 ),
469 'actions-search' => array(
470 'provider' => SvgIconProvider::class,
471 'options' => array(
472 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-search.svg',
473 )
474 ),
475 'actions-system-cache-clear-impact-low' => array(
476 'provider' => SvgIconProvider::class,
477 'options' => array(
478 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-system-cache-clear-impact-low.svg',
479 )
480 ),
481 'actions-system-cache-clear-impact-medium' => array(
482 'provider' => SvgIconProvider::class,
483 'options' => array(
484 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-system-cache-clear-impact-medium.svg',
485 )
486 ),
487 'actions-system-cache-clear-impact-high' => array(
488 'provider' => SvgIconProvider::class,
489 'options' => array(
490 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-system-cache-clear-impact-high.svg',
491 )
492 ),
493 'actions-system-help-open' => array(
494 'provider' => SvgIconProvider::class,
495 'options' => array(
496 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-system-help-open.svg',
497 )
498 ),
499 'actions-system-extension-configure' => array(
500 'provider' => FontawesomeIconProvider::class,
501 'options' => array(
502 'name' => 'gear',
503 )
504 ),
505 'actions-system-extension-download' => array(
506 'provider' => FontawesomeIconProvider::class,
507 'options' => array(
508 'name' => 'download',
509 )
510 ),
511 'actions-system-extension-install' => array(
512 'provider' => FontawesomeIconProvider::class,
513 'options' => array(
514 'name' => 'plus-circle',
515 )
516 ),
517 'actions-system-extension-import' => array(
518 'provider' => FontawesomeIconProvider::class,
519 'options' => array(
520 'name' => 'cloud-download',
521 )
522 ),
523 'actions-system-extension-uninstall' => array(
524 'provider' => FontawesomeIconProvider::class,
525 'options' => array(
526 'name' => 'minus-square',
527 )
528 ),
529 'actions-system-extension-sqldump' => array(
530 'provider' => FontawesomeIconProvider::class,
531 'options' => array(
532 'name' => 'database',
533 )
534 ),
535 'actions-system-extension-update' => array(
536 'provider' => FontawesomeIconProvider::class,
537 'options' => array(
538 'name' => 'refresh',
539 )
540 ),
541 'actions-system-list-open' => array(
542 'provider' => FontawesomeIconProvider::class,
543 'options' => array(
544 'name' => 'list-alt',
545 )
546 ),
547 'actions-system-shortcut-new' => array(
548 'provider' => FontawesomeIconProvider::class,
549 'options' => array(
550 'name' => 'star',
551 )
552 ),
553 'actions-version-open' => array(
554 'provider' => FontawesomeIconProvider::class,
555 'options' => array(
556 'name' => 'refresh',
557 )
558 ),
559 'actions-system-tree-search-open' => array(
560 'provider' => SvgIconProvider::class,
561 'options' => array(
562 'source' => 'EXT:backend/Resources/Public/Icons/Action/actions-system-tree-search-open.svg',
563 )
564 ),
565 'actions-system-refresh' => array(
566 'provider' => FontawesomeIconProvider::class,
567 'options' => array(
568 'name' => 'refresh',
569 )
570 ),
571 'actions-version-swap-version' => array(
572 'provider' => FontawesomeIconProvider::class,
573 'options' => array(
574 'name' => 'exchange',
575 )
576 ),
577 'actions-unmarkstate' => array(
578 'provider' => FontawesomeIconProvider::class,
579 'options' => array(
580 'name' => 'check-square-o',
581 )
582 ),
583 'actions-view-go-back' => array(
584 'provider' => FontawesomeIconProvider::class,
585 'options' => array(
586 'name' => 'angle-double-left',
587 )
588 ),
589 'actions-view-go-forward' => array(
590 'provider' => FontawesomeIconProvider::class,
591 'options' => array(
592 'name' => 'angle-double-right',
593 )
594 ),
595 'actions-view-go-up' => array(
596 'provider' => FontawesomeIconProvider::class,
597 'options' => array(
598 'name' => 'level-up',
599 )
600 ),
601 'actions-view-paging-first' => array(
602 'provider' => FontawesomeIconProvider::class,
603 'options' => array(
604 'name' => 'step-backward',
605 )
606 ),
607 'actions-view-paging-last' => array(
608 'provider' => FontawesomeIconProvider::class,
609 'options' => array(
610 'name' => 'step-forward',
611 )
612 ),
613 'actions-view-paging-previous' => array(
614 'provider' => FontawesomeIconProvider::class,
615 'options' => array(
616 'name' => 'arrow-left',
617 )
618 ),
619 'actions-view-paging-next' => array(
620 'provider' => FontawesomeIconProvider::class,
621 'options' => array(
622 'name' => 'arrow-right',
623 )
624 ),
625 'actions-view-table-collapse' => array(
626 'provider' => FontawesomeIconProvider::class,
627 'options' => array(
628 'name' => 'chevron-left',
629 )
630 ),
631 'actions-view-table-expand' => array(
632 'provider' => FontawesomeIconProvider::class,
633 'options' => array(
634 'name' => 'chevron-right',
635 )
636 ),
637 'actions-window-open' => array(
638 'provider' => FontawesomeIconProvider::class,
639 'options' => array(
640 'name' => 'arrows-alt',
641 )
642 ),
643
644 // specials
645 'empty-empty' => array(
646 'provider' => FontawesomeIconProvider::class,
647 'options' => array(
648 'name' => 'empty-empty',
649 )
650 ),
651
652 // Miscellaneous icons
653 'miscellaneous-placeholder' => array(
654 'provider' => SvgIconProvider::class,
655 'options' => array(
656 'source' => 'EXT:backend/Resources/Public/Icons/Miscellaneous/miscellaneous-placeholder.svg',
657 )
658 ),
659
660 // Status
661 'status-status-checked' => array(
662 'provider' => FontawesomeIconProvider::class,
663 'options' => array(
664 'name' => 'check',
665 )
666 ),
667 'status-status-current' => array(
668 'provider' => FontawesomeIconProvider::class,
669 'options' => array(
670 'name' => 'caret-right',
671 )
672 ),
673 'status-status-locked' => array(
674 'provider' => FontawesomeIconProvider::class,
675 'options' => array(
676 'name' => 'lock',
677 )
678 ),
679 'status-status-sorting-asc' => array(
680 'provider' => FontawesomeIconProvider::class,
681 'options' => array(
682 'name' => 'caret-up',
683 )
684 ),
685 'status-status-sorting-desc' => array(
686 'provider' => FontawesomeIconProvider::class,
687 'options' => array(
688 'name' => 'caret-down',
689 )
690 ),
691 'status-status-sorting-light-asc' => array(
692 'provider' => FontawesomeIconProvider::class,
693 'options' => array(
694 'name' => 'caret-up',
695 )
696 ),
697 'status-status-sorting-light-desc' => array(
698 'provider' => FontawesomeIconProvider::class,
699 'options' => array(
700 'name' => 'caret-down',
701 )
702 ),
703 'status-dialog-ok' => array(
704 'provider' => FontawesomeIconProvider::class,
705 'options' => array(
706 'name' => 'check-circle',
707 )
708 ),
709 'status-dialog-notification' => array(
710 'provider' => FontawesomeIconProvider::class,
711 'options' => array(
712 'name' => 'exclamation-circle',
713 )
714 ),
715 'status-dialog-warning' => array(
716 'provider' => FontawesomeIconProvider::class,
717 'options' => array(
718 'name' => 'exclamation-triangle',
719 )
720 ),
721 'status-dialog-error' => array(
722 'provider' => FontawesomeIconProvider::class,
723 'options' => array(
724 'name' => 'exclamation-circle',
725 )
726 ),
727 'status-warning-lock' => array(
728 'provider' => BitmapIconProvider::class,
729 'options' => array(
730 'source' => 'EXT:t3skin/images/icons/status/warning-lock.png',
731 )
732 ),
733 'status-status-permission-granted' => array(
734 'provider' => FontawesomeIconProvider::class,
735 'options' => array(
736 'name' => 'check',
737 )
738 ),
739 'status-status-permission-denied' => array(
740 'provider' => FontawesomeIconProvider::class,
741 'options' => array(
742 'name' => 'times',
743 )
744 ),
745
746 // Mimetypes
747 'mimetypes-text-html' => array(
748 'provider' => FontawesomeIconProvider::class,
749 'options' => array(
750 'name' => 'file-text-o',
751 )
752 ),
753 'mimetypes-word' => array(
754 'provider' => FontawesomeIconProvider::class,
755 'options' => array(
756 'name' => 'file-word-o',
757 )
758 ),
759
760 // Spinner
761 'spinner-circle-dark' => array(
762 'provider' => SvgIconProvider::class,
763 'options' => array(
764 'source' => 'EXT:backend/Resources/Public/Icons/Spinner/spinner-circle-dark.svg',
765 'spinning' => TRUE
766 )
767 ),
768 'spinner-circle-light' => array(
769 'provider' => SvgIconProvider::class,
770 'options' => array(
771 'source' => 'EXT:backend/Resources/Public/Icons/Spinner/spinner-circle-light.svg',
772 'spinning' => TRUE
773 )
774 ),
775
776 // Overlays
777 'overlay-read-only' => array(
778 'provider' => FontawesomeIconProvider::class,
779 'options' => array(
780 'name' => 'times-circle',
781 )
782 ),
783 );
784
785 /**
786 * @var string
787 */
788 protected $defaultIconIdentifier = 'default-not-found';
789
790 /**
791 * @param string $identifier
792 *
793 * @return bool
794 */
795 public function isRegistered($identifier) {
796 return !empty($this->icons[$identifier]);
797 }
798
799 /**
800 * @return string
801 */
802 public function getDefaultIconIdentifier() {
803 return $this->defaultIconIdentifier;
804 }
805
806 /**
807 * Registers an icon to be available inside the Icon Factory
808 *
809 * @param string $identifier
810 * @param string $iconProviderClassName
811 * @param array $options
812 *
813 * @throws \InvalidArgumentException
814 */
815 public function registerIcon($identifier, $iconProviderClassName, array $options = array()) {
816 if (!in_array(IconProviderInterface::class, class_implements($iconProviderClassName), TRUE)) {
817 throw new \InvalidArgumentException('An IconProvider must implement ' . IconProviderInterface::class, 1437425803);
818 }
819 $this->icons[$identifier] = array(
820 'provider' => $iconProviderClassName,
821 'options' => $options
822 );
823 }
824
825 /**
826 * Fetches the configuration provided by registerIcon()
827 *
828 * @param string $identifier the icon identifier
829 * @return mixed
830 * @throws Exception
831 */
832 public function getIconConfigurationByIdentifier($identifier) {
833 if (!$this->isRegistered($identifier)) {
834 throw new Exception('Icon with identifier "' . $identifier . '" is not registered"', 1437425804);
835 }
836 return $this->icons[$identifier];
837 }
838
839 /**
840 * @return array
841 * @internal
842 */
843 public function getAllRegisteredIconIdentifiers() {
844 return array_keys($this->icons);
845 }
846 }