TYPO3 CMS  TYPO3_8-7
FlashMessage.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 {
30  protected $storeInSession = false;
31 
36  protected $classes = [
37  self::NOTICE => 'notice',
38  self::INFO => 'info',
39  self::OK => 'success',
40  self::WARNING => 'warning',
41  self::ERROR => 'danger'
42  ];
43 
48  protected $icons = [
49  self::NOTICE => 'lightbulb-o',
50  self::INFO => 'info',
51  self::OK => 'check',
52  self::WARNING => 'exclamation',
53  self::ERROR => 'times'
54  ];
55 
64  public function __construct($message, $title = '', $severity = self::OK, $storeInSession = false)
65  {
66  $this->setMessage($message);
67  $this->setTitle($title);
68  $this->setSeverity($severity);
70  }
71 
77  public function isSessionMessage()
78  {
79  return $this->storeInSession;
80  }
81 
88  {
89  $this->storeInSession = (bool)$storeInSession;
90  }
91 
98  public function getClass()
99  {
101  return 'alert-' . $this->classes[$this->severity];
102  }
103 
110  public function getIconName()
111  {
113  return $this->icons[$this->severity];
114  }
115 }
__construct($message, $title='', $severity=self::OK, $storeInSession=false)