Skip to content

Commit

Permalink
[TASK] Remove ErrorIconViewHelper and move logic into model and template
Browse files Browse the repository at this point in the history
Simplify generation of the error icon by removing the ViewHelper and
generate the icon identifier in the model instead.

As the ViewHelper is no public API it can be removed without a RST file.

Resolves: #83945
Releases: master
Change-Id: I7515ff69a729ccb66288437f5236a1ce8fa591c1
Reviewed-on: https://review.typo3.org/55763
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
  • Loading branch information
georgringer authored and wouter90 committed Feb 19, 2018
1 parent 70e2d2f commit 5ff6ca6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 73 deletions.
18 changes: 18 additions & 0 deletions typo3/sysext/belog/Classes/Domain/Model/LogEntry.php
Expand Up @@ -278,6 +278,24 @@ public function getError()
return (int)$this->error;
}

/**
* Get class name for the error code
*
* @return string
*/
public function getErrorIconClass(): string
{
switch ($this->getError()) {
case 1:
return 'status-dialog-warning';
case 2:
case 3:
return 'status-dialog-error';
default:
return 'empty-empty';
}
}

/**
* Set details
*
Expand Down
72 changes: 0 additions & 72 deletions typo3/sysext/belog/Classes/ViewHelpers/ErrorIconViewHelper.php

This file was deleted.

Expand Up @@ -139,7 +139,9 @@ <h3>
<f:for each="{day}" as="logItem">
<tr>
<td>
<belog:ErrorIcon errorNumber="{logItem.error}"/>
<f:if condition="{logItem.errorIconClass}">
<core:icon identifier="{logItem.errorIconClass}" />
</f:if>
</td>
<td>
<f:format.date format="H:i:s">@{logItem.tstamp}</f:format.date>
Expand Down

0 comments on commit 5ff6ca6

Please sign in to comment.