[BUGFIX] Syslog error icons problem 30/17130/4
authorTomita Militaru <militarutomita@gmail.com>
Wed, 12 Dec 2012 13:31:36 +0000 (15:31 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Mon, 31 Dec 2012 23:20:33 +0000 (00:20 +0100)
Add an array with the possible error messages and shows
the corresponding icon.

Fixes: #43796
Releases: 6.1, 6.0
Change-Id: I6cbdcdf92147c438a443d29664965bee17c29d51
Reviewed-on: https://review.typo3.org/17130
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php

index 715f378..2395a16 100644 (file)
@@ -25,6 +25,7 @@ namespace TYPO3\CMS\Belog\ViewHelpers;
  *
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
+
 /**
  * Display error icon from error integer value
  *
@@ -34,20 +35,21 @@ class ErrorIconViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
 
        /**
         * Renders an error icon link as known from the TYPO3 backend.
-        * Error codes 2 and three are mapped to "error", -1 and 1 are mapped to "warning".
+        * Error codes 2 and three are mapped to "error" and 1 is mapped to "warning".
         *
-        * @param integer $errorNumber The error number (-1 ... 3)
+        * @param integer $errorNumber The error number (0 ... 3)
         * @return string the rendered error icon link
         */
        public function render($errorNumber = 0) {
-               return $this->getDocInstance()->icons(
-                       $errorNumber >= 2
-                                       ? \TYPO3\CMS\Backend\Template\DocumentTemplate::STATUS_ICON_ERROR
-                                       : \TYPO3\CMS\Backend\Template\DocumentTemplate::STATUS_ICON_WARNING
+               $errorSymbols = array(
+                       '0' => '',
+                       '1' => \TYPO3\CMS\Backend\Template\DocumentTemplate::STATUS_ICON_WARNING,
+                       '2' => \TYPO3\CMS\Backend\Template\DocumentTemplate::STATUS_ICON_ERROR,
+                       '3' => \TYPO3\CMS\Backend\Template\DocumentTemplate::STATUS_ICON_ERROR
                );
+               return $this->getDocInstance()->icons($errorSymbols[$errorNumber]);
        }
 
 }
 
-
 ?>
\ No newline at end of file