[BUGFIX] Expose IconFactory in ModuleTemplate rather than AbstractModule
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Template / ModuleTemplate.php
1 <?php
2 namespace TYPO3\CMS\Backend\Template;
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\Backend\Template\Components\DocHeaderComponent;
18 use TYPO3\CMS\Backend\Utility\BackendUtility;
19 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
20 use TYPO3\CMS\Core\Imaging\Icon;
21 use TYPO3\CMS\Core\Imaging\IconFactory;
22 use TYPO3\CMS\Core\Page\PageRenderer;
23 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
24 use TYPO3\CMS\Core\Utility\GeneralUtility;
25 use TYPO3\CMS\Fluid\View\Exception\InvalidTemplateResourceException;
26 use TYPO3\CMS\Fluid\View\StandaloneView;
27 use TYPO3\CMS\Lang\LanguageService;
28 use TYPO3\CMS\Version\View\VersionView;
29
30 /**
31 * A class taking care of the "outer" HTML of a module, especially
32 * the doc header and other related parts.
33 *
34 * @internal This API is not yet carved in stone and may be adapted later.
35 */
36 class ModuleTemplate {
37
38 /**
39 * Error Icon Constant
40 *
41 * @internal
42 */
43 const STATUS_ICON_ERROR = 3;
44
45 /**
46 * Warning Icon Constant
47 *
48 * @internal
49 */
50 const STATUS_ICON_WARNING = 2;
51
52 /**
53 * Notification Icon Constant
54 *
55 * @internal
56 */
57 const STATUS_ICON_NOTIFICATION = 1;
58
59 /**
60 * OK Icon Constant
61 *
62 * @internal
63 */
64 const STATUS_ICON_OK = -1;
65
66 /**
67 * DocHeaderComponent
68 *
69 * @var DocHeaderComponent
70 */
71 protected $docHeaderComponent;
72
73 /**
74 * Javascript Code Array
75 * Used for inline JS
76 *
77 * @var array
78 */
79 protected $javascriptCodeArray = [];
80
81 /**
82 * Expose the pageRenderer
83 *
84 * @var PageRenderer
85 */
86 protected $pageRenderer;
87
88 /**
89 * TemplateRootPath
90 *
91 * @var string
92 */
93 protected $templateRootPath = 'EXT:backend/Resources/Private/Templates';
94
95 /**
96 * PartialRootPath
97 *
98 * @var string
99 */
100 protected $partialRootPath = 'EXT:backend/Resources/Private/Partials';
101
102 /**
103 * LayoutRootPath
104 *
105 * @var string
106 */
107 protected $layoutRootPath = 'EXT:backend/Resources/Private/Layouts';
108
109 /**
110 * Template name
111 *
112 * @var string
113 */
114 protected $templateFile = 'Module.html';
115
116 /**
117 * Fluid Standalone View
118 *
119 * @var StandaloneView
120 */
121 protected $view;
122
123 /**
124 * Content String
125 *
126 * @var string
127 */
128 protected $content = '';
129
130 /**
131 * Defines whether a section has been opened before
132 *
133 * @var int
134 */
135 protected $sectionFlag = 0;
136
137 /**
138 * IconFactory Member
139 *
140 * @var IconFactory
141 */
142 protected $iconFactory;
143
144 /**
145 * Module ID
146 *
147 * @var string
148 */
149 protected $moduleId = '';
150
151 /**
152 * Module Name
153 *
154 * @var string
155 */
156 protected $moduleName = '';
157
158 /**
159 * Title Tag
160 *
161 * @var string
162 */
163 protected $title = '';
164
165 /**
166 * Get template root path
167 *
168 * @return string
169 */
170 public function getTemplateRootPath() {
171 return $this->templateRootPath;
172 }
173
174 /**
175 * Set content
176 *
177 * @param string $content Content of the module
178 *
179 * @return void
180 */
181 public function setContent($content) {
182 $this->view->assign('content', $content);
183 }
184
185 /**
186 * Set title tag
187 *
188 * @param string $title
189 */
190 public function setTitle($title) {
191 $this->title = $title;
192 }
193
194 /**
195 * Returns the IconFactory
196 *
197 * @return IconFactory
198 */
199 public function getIconFactory() {
200 return $this->iconFactory;
201 }
202
203 /**
204 * Class constructor
205 * Sets up view and property objects
206 *
207 * @throws InvalidTemplateResourceException In case a template is invalid
208 */
209 public function __construct() {
210 $this->view = GeneralUtility::makeInstance(StandaloneView::class);
211 $this->view->setPartialRootPaths([$this->partialRootPath]);
212 $this->view->setTemplateRootPaths([$this->templateRootPath]);
213 $this->view->setLayoutRootPaths([$this->layoutRootPath]);
214 $this->view->setTemplate($this->templateFile);
215 $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
216 $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
217 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
218 }
219
220 /**
221 * Loads all necessary Javascript Files
222 *
223 * @return void
224 */
225 protected function loadJavaScripts() {
226 $this->pageRenderer->loadJquery();
227 $this->pageRenderer->loadRequireJsModule('bootstrap');
228 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextHelp');
229 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DocumentHeader');
230 }
231
232 /**
233 * Loads all necessary stylesheets
234 *
235 * @return void
236 */
237 protected function loadStylesheets() {
238 if ($GLOBALS['TBE_STYLES']['stylesheet']) {
239 $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet']);
240 }
241 if ($GLOBALS['TBE_STYLES']['stylesheet2']) {
242 $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet2']);
243 }
244 }
245
246 /**
247 * Sets mandatory parameters for the view (pageRenderer)
248 *
249 * @return void
250 */
251 protected function setupPage() {
252 // Yes, hardcoded on purpose
253 $this->pageRenderer->setCharSet('utf-8');
254 $this->pageRenderer->setLanguage('default');
255 }
256
257 /**
258 * Wrapper function for adding JS inline blocks
259 *
260 * @return void
261 */
262 protected function setJavaScriptCodeArray() {
263 foreach ($this->javascriptCodeArray as $name => $code) {
264 $this->pageRenderer->addJsInlineCode($name, $code, FALSE);
265 }
266 }
267
268 /**
269 * Adds JS inline blocks of code to the internal registry
270 *
271 * @param string $name Javascript code block name
272 * @param string $code Inline Javascript
273 *
274 * @return void
275 */
276 public function addJavaScriptCode($name = '', $code = '') {
277 $this->javascriptCodeArray[$name] = $code;
278 }
279
280 /**
281 * Get the DocHeader
282 *
283 * @return DocHeaderComponent
284 */
285 public function getDocHeaderComponent() {
286 return $this->docHeaderComponent;
287 }
288
289 /**
290 * Returns the fully rendered view
291 *
292 * @return string
293 */
294 public function renderContent() {
295 $this->setupPage();
296 $this->pageRenderer->setTitle($this->title);
297 $this->loadJavaScripts();
298 $this->setJavaScriptCodeArray();
299 $this->loadStylesheets();
300
301 $this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
302 if ($this->moduleId) {
303 $this->view->assign('moduleId', $this->moduleId);
304 }
305 if ($this->moduleName) {
306 $this->view->assign('moduleName', $this->moduleName);
307 }
308
309 $renderedPage = $this->pageRenderer->render(PageRenderer::PART_HEADER);
310 $renderedPage .= $this->view->render();
311 $renderedPage .= $this->pageRenderer->render(PageRenderer::PART_FOOTER);
312
313 return $renderedPage;
314 }
315
316 /**
317 * Get PageRenderer
318 *
319 * @return PageRenderer
320 */
321 public function getPageRenderer() {
322 return $this->pageRenderer;
323 }
324
325 /**
326 * Set form tag
327 *
328 * @param string $formTag Form tag to add
329 *
330 * @return void
331 */
332 public function setForm($formTag = '') {
333 $this->view->assign('formTag', $formTag);
334 }
335
336 /**
337 * Sets the ModuleId
338 *
339 * @param string $moduleId ID of the module
340 *
341 * @return void
342 */
343 public function setModuleId($moduleId) {
344 $this->moduleId = $moduleId;
345 $this->registerModuleMenu($moduleId);
346 }
347
348 /**
349 * Sets the ModuleName
350 *
351 * @param string $moduleName Name of the module
352 *
353 * @return void
354 */
355 public function setModuleName($moduleName) {
356 $this->moduleName = $moduleName;
357 }
358
359 /**
360 * Generates the Menu for things like Web->Info
361 *
362 * @param $moduleMenuIdentifier
363 */
364 public function registerModuleMenu($moduleMenuIdentifier) {
365 if (isset($GLOBALS['TBE_MODULES_EXT'][$moduleMenuIdentifier])) {
366 $menuEntries =
367 $GLOBALS['TBE_MODULES_EXT'][$moduleMenuIdentifier]['MOD_MENU']['function'];
368 $menu = $this->getDocHeaderComponent()->getMenuRegistry()->makeMenu()->setIdentifier('MOD_FUNC');
369 foreach ($menuEntries as $menuEntry) {
370 $menuItem = $menu->makeMenuItem()
371 ->setTitle($menuEntry['title'])
372 ->setHref('#');
373 $menu->addMenuItem($menuItem);
374 }
375 $this->docHeaderComponent->getMenuRegistry()->addMenu($menu);
376 }
377 }
378
379
380
381 /*******************************************
382 * THE FOLLOWING METHODS ARE SUBJECT TO BE DEPRECATED / DROPPED!
383 *
384 * These methods have been copied over from DocumentTemplate and enables
385 * core modules to drop the dependency to DocumentTemplate altogether without
386 * rewriting these modules now.
387 * The methods below are marked as internal and will be removed
388 * one-by-one with further refactoring of modules.
389 *
390 * Do not use these methods within own extensions if possible or
391 * be prepared to change this later again.
392 *******************************************/
393
394 /**
395 * Makes click menu link (context sensitive menu)
396 * Returns $str (possibly an <|img> tag/icon) wrapped in a link which will
397 * activate the context sensitive menu for the record ($table/$uid) or
398 * file ($table = file)
399 * The link will load the top frame with the parameter "&item" which is
400 * the table,uid and listFr arguments imploded
401 * by "|": rawurlencode($table.'|'.$uid.'|'.$listFr)
402 *
403 * @param string $content String to be wrapped in link, typ. image tag.
404 * @param string $table Table name/File path. If the icon is for a database
405 * record, enter the tablename from $GLOBALS['TCA']. If a file then enter
406 * the absolute filepath
407 * @param int $uid If icon is for database record this is the UID for the
408 * record from $table
409 * @param bool $listFr Tells the top frame script that the link is coming
410 * from a "list" frame which means a frame from within the backend content frame.
411 * @param string $addParams Additional GET parameters for the link to the
412 * ClickMenu AJAX request
413 * @param string $enDisItems Enable / Disable click menu items.
414 * Example: "+new,view" will display ONLY these two items (and any spacers
415 * in between), "new,view" will display all BUT these two items.
416 * @param bool $returnTagParameters If set, will return only the onclick
417 * JavaScript, not the whole link.
418 *
419 * @return string The link-wrapped input string.
420 * @internal
421 */
422 public function wrapClickMenuOnIcon(
423 $content,
424 $table,
425 $uid = 0,
426 $listFr = TRUE,
427 $addParams = '',
428 $enDisItems = '',
429 $returnTagParameters = FALSE
430 ) {
431 $tagParameters = array(
432 'class' => 't3-js-clickmenutrigger',
433 'data-table' => $table,
434 'data-uid' => (int)$uid !== 0 ? (int)$uid : '',
435 'data-listframe' => $listFr,
436 'data-iteminfo' => str_replace('+', '%2B', $enDisItems),
437 'data-parameters' => $addParams,
438 );
439
440 if ($returnTagParameters) {
441 return $tagParameters;
442 }
443 return '<a href="#" ' . GeneralUtility::implodeAttributes($tagParameters, TRUE) . '>' . $content . '</a>';
444 }
445
446 /**
447 * Includes a javascript library that exists in the core /typo3/ directory
448 *
449 * @param string $lib Library name. Call it with the full path like
450 * "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it
451 *
452 * @return void
453 * @internal
454 */
455 public function loadJavascriptLib($lib) {
456 // @todo: maybe we can remove this one as well
457 $this->pageRenderer->addJsFile($lib);
458 }
459
460 /**
461 * Returns a linked shortcut-icon which will call the shortcut frame and set a
462 * shortcut there back to the calling page/module
463 *
464 * @param string $gvList Is the list of GET variables to store (if any)
465 * @param string $setList Is the list of SET[] variables to store
466 * (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS
467 * for backend modules
468 * @param string $modName Module name string
469 * @param string|int $motherModName Is used to enter the "parent module
470 * name" if the module is a submodule under eg. Web>* or File>*. You
471 * can also set this value to 1 in which case the currentLoadedModule
472 * is sent to the shortcut script (so - not a fixed value!) - that is used
473 * in file_edit and wizard_rte modules where those are really running as
474 * a part of another module.
475 *
476 * @return string HTML content
477 * @todo Make this thing return a button object
478 * @internal
479 */
480 public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '') {
481 $storeUrl = $this->makeShortcutUrl($gvList, $setList);
482 $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
483 // Fallback for alt_mod. We still pass in the old xMOD... stuff,
484 // but TBE_MODULES only knows about "record_edit".
485 // We still need to pass the xMOD name to createShortcut below,
486 // since this is used for icons.
487 $moduleName = $modName === 'xMOD_alt_doc.php' ? 'record_edit' : $modName;
488 // Add the module identifier automatically if typo3/index.php is used:
489 if (GeneralUtility::_GET('M') !== NULL && isset($GLOBALS['TBE_MODULES']['_PATHS'][$moduleName])) {
490 $storeUrl = '&M=' . $moduleName . $storeUrl;
491 }
492 if ((int)$motherModName === 1) {
493 $motherModule = 'top.currentModuleLoaded';
494 } elseif ($motherModName) {
495 $motherModule = GeneralUtility::quoteJSvalue($motherModName);
496 } else {
497 $motherModule = '\'\'';
498 }
499 $confirmationText = GeneralUtility::quoteJSvalue(
500 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark')
501 );
502
503 $shortcutUrl = $pathInfo['path'] . '?' . $storeUrl;
504 $shortcutExist = BackendUtility::shortcutExists($shortcutUrl);
505
506 if ($shortcutExist) {
507 return '<a class="active" title="">' .
508 $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</a>';
509 }
510
511 $url = GeneralUtility::quoteJSvalue(rawurlencode($shortcutUrl));
512 $onClick = 'top.TYPO3.ShortcutMenu.createShortcut(' . GeneralUtility::quoteJSvalue(rawurlencode($modName)) .
513 ', ' . $url . ', ' . $confirmationText . ', ' . $motherModule . ', this);return false;';
514
515 return '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' .
516 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.makeBookmark', TRUE) . '">' .
517 $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</a>';
518 }
519
520 /**
521 * MAKE url for storing
522 * Internal func
523 *
524 * @param string $gvList Is the list of GET variables to store (if any)
525 * @param string $setList Is the list of SET[] variables to store (if any)
526 * - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend
527 * modules
528 *
529 * @return string
530 * @internal
531 */
532 public function makeShortcutUrl($gvList, $setList) {
533 $getParams = GeneralUtility::_GET();
534 $storeArray = array_merge(
535 GeneralUtility::compileSelectedGetVarsFromArray($gvList, $getParams),
536 array('SET' => GeneralUtility::compileSelectedGetVarsFromArray($setList, (array)$GLOBALS['SOBE']->MOD_SETTINGS))
537 );
538 return GeneralUtility::implodeArrayForUrl('', $storeArray);
539 }
540
541 /**
542 * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
543 * See description of the API elsewhere.
544 *
545 * @param string $params Is a set of GET params to send to tce_db.php.
546 * Example: "&cmd[tt_content][123][move]=456" or
547 * "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
548 * @param string|int $redirectUrl Redirect URL, default is to use
549 * GeneralUtility::getIndpEnv('REQUEST_URI'), -1 means to generate
550 * an URL for JavaScript using T3_THIS_LOCATION
551 *
552 * @return string URL to BackendUtility::getModuleUrl('tce_db') + parameters
553 * @internal
554 */
555 public function issueCommand($params, $redirectUrl = '') {
556 $urlParameters = [
557 'prErr' => 1,
558 'uPT' => 1,
559 'vC' => $this->getBackendUserAuthentication()->veriCode()
560 ];
561 $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . $params . '&redirect=';
562 if ((int)$redirectUrl === -1) {
563 $url = GeneralUtility::quoteJSvalue($url) . '+T3_THIS_LOCATION';
564 } else {
565 $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI'));
566 }
567 return $url;
568 }
569
570 /**
571 * Creates the version selector for the page id inputted.
572 * Requires the core version management extension, "version" to be loaded.
573 *
574 * @param int $id Page id to create selector for.
575 * @param bool $noAction If set, there will be no button for swapping page.
576 *
577 * @return string
578 * @internal
579 */
580 public function getVersionSelector($id, $noAction = FALSE) {
581 if (
582 ExtensionManagementUtility::isLoaded('version') &&
583 !ExtensionManagementUtility::isLoaded('workspaces')
584 ) {
585 /**
586 * For Code Completion
587 *
588 * @var $versionGuiObj VersionView
589 */
590 $versionGuiObj = GeneralUtility::makeInstance(VersionView::class);
591 return $versionGuiObj->getVersionSelector($id, $noAction);
592 }
593 return '';
594 }
595
596 /**
597 * Begins an output section and sets header and content
598 *
599 * @param string $label The header
600 * @param string $text The HTML-content
601 * @param bool $noStrToUpper A flag that will prevent the header from
602 * being converted to uppercase
603 * @param bool $sH Defines the type of header (if set, "<h3>" rather
604 * than the default "h4")
605 * @param int $type The number of an icon to show with the header
606 * (see the icon-function). -1,1,2,3
607 * @param bool $allowHtmlInHeader If set, HTML tags are allowed in
608 * $label (otherwise this value is by default htmlspecialchars()'ed)
609 *
610 * @return string HTML content
611 * @internal
612 */
613 public function section($label, $text, $noStrToUpper = FALSE, $sH = FALSE, $type = 0, $allowHtmlInHeader = FALSE) {
614 $str = '';
615 // Setting header
616 if ($label) {
617 if (!$allowHtmlInHeader) {
618 $label = htmlspecialchars($label);
619 }
620 $str .= $this->sectionHeader($this->icons($type) . $label, $sH, $noStrToUpper ? '' : ' class="uppercase"');
621 }
622 // Setting content
623 $str .= '
624
625 <!-- Section content -->
626 ' . $text;
627 return $this->sectionBegin() . $str;
628 }
629
630 /**
631 * Inserts a divider image
632 * Ends a section (if open) before inserting the image
633 *
634 * @param int $dist The margin-top/-bottom of the <hr> ruler.
635 *
636 * @return string HTML content
637 * @internal
638 */
639 public function divider($dist) {
640 $dist = (int)$dist;
641 $str = '
642
643 <!-- DIVIDER -->
644 <hr style="margin-top: ' . $dist . 'px; margin-bottom: ' . $dist . 'px;" />
645 ';
646 return $this->sectionEnd() . $str;
647 }
648
649 /**
650 * Returns a blank <div>-section with a height
651 *
652 * @param int $dist Padding-top for the div-section
653 *
654 * @return string HTML content
655 * @internal
656 */
657 public function spacer($dist) {
658 if ($dist > 0) {
659 return '
660
661 <!-- Spacer element -->
662 <div style="padding-top: ' . (int)$dist . 'px;"></div>
663 ';
664 }
665 return '';
666 }
667
668 /**
669 * Make a section header.
670 * Begins a section if not already open.
671 *
672 * @param string $label The label between the <h3> or <h4> tags. (Allows HTML)
673 * @param bool $sH If set, <h3> is used, otherwise <h4>
674 * @param string $addAttribute Additional attributes to h-tag, eg. ' class=""'
675 *
676 * @return string HTML content
677 * @internal
678 */
679 public function sectionHeader($label, $sH = FALSE, $addAttribute = '') {
680 $tag = $sH ? 'h2' : 'h3';
681 if ($addAttribute && $addAttribute[0] !== ' ') {
682 $addAttribute = ' ' . $addAttribute;
683 }
684 $str = '
685
686 <!-- Section header -->
687 <' . $tag . $addAttribute . '>' . $label . '</' . $tag . '>
688 ';
689 return $this->sectionBegin() . $str;
690 }
691
692 /**
693 * Begins an output section.
694 * Returns the <div>-begin tag AND sets the ->sectionFlag TRUE
695 * (if the ->sectionFlag is not already set!)
696 * You can call this function even if a section is already begun
697 * since the function will only return something if the sectionFlag
698 * is not already set!
699 *
700 * @return string HTML content
701 * @internal
702 */
703 public function sectionBegin() {
704 if (!$this->sectionFlag) {
705 $this->sectionFlag = 1;
706 $str = '
707
708 <!-- ***********************
709 Begin output section.
710 *********************** -->
711 <div>
712 ';
713 return $str;
714 }
715 return '';
716 }
717
718 /**
719 * Ends and output section
720 * Returns the </div>-end tag AND clears the ->sectionFlag
721 * (but does so only IF the sectionFlag is set - that is a section is 'open')
722 * See sectionBegin() also.
723 *
724 * @return string HTML content
725 * @internal
726 */
727 public function sectionEnd() {
728 if ($this->sectionFlag) {
729 $this->sectionFlag = 0;
730 return '
731 </div>
732 <!-- *********************
733 End output section.
734 ********************* -->
735 ';
736 }
737 return '';
738 }
739
740
741
742 /**
743 * Returns the BE USER Object
744 *
745 * @return BackendUserAuthentication
746 */
747 protected function getBackendUserAuthentication() {
748 return $GLOBALS['BE_USER'];
749 }
750
751 /**
752 * Returns the LanguageService
753 *
754 * @return LanguageService
755 */
756 protected function getLanguageService() {
757 return $GLOBALS['LANG'];
758 }
759
760 /**
761 * Returns an image-tag with an 18x16 icon of the following types:
762 *
763 * $type:
764 * -1:» OK icon (Check-mark)
765 * 1:» Notice (Speach-bubble)
766 * 2:» Warning (Yellow triangle)
767 * 3:» Fatal error (Red stop sign)
768 *
769 * @param int $type See description
770 *
771 * @return string HTML image tag (if applicable)
772 * @internal
773 */
774 public function icons($type) {
775 $icon = '';
776 switch ($type) {
777 case self::STATUS_ICON_ERROR:
778 $icon = 'status-dialog-error';
779 break;
780 case self::STATUS_ICON_WARNING:
781 $icon = 'status-dialog-warning';
782 break;
783 case self::STATUS_ICON_NOTIFICATION:
784 $icon = 'status-dialog-notification';
785 break;
786 case self::STATUS_ICON_OK:
787 $icon = 'status-dialog-ok';
788 break;
789 default:
790 // Do nothing
791 }
792 if ($icon != '') {
793 return $this->iconFactory->getIcon($icon, Icon::SIZE_SMALL)->render();
794 }
795 return '';
796 }
797
798 }