Commit 8093cb00 authored by Claus Due's avatar Claus Due Committed by Markus Klein
Browse files

[TASK] Improve LogEntries partial performance

This patch avoids `f:switch` in the partial template,
since this ViewHelper is not compilable in the
version provided as override from TYPO3 CMS.

The patch also adds the CompileWithRenderStatic
trait to a ViewHelper used frequently in that partial.

Change-Id: I768e43e7c70a17fef04c28774169d4b3badb310b
Resolves: #79542
Releases: master
Reviewed-on: https://review.typo3.org/51464

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Philipp Gampe's avatarPhilipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe's avatarPhilipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarThomas Hohn <thomas@hohn.dk>
Tested-by: default avatarThomas Hohn <thomas@hohn.dk>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
parent ed293f91
......@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
/**
* Display error icon from error integer value
......@@ -26,6 +27,8 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
*/
class ErrorIconViewHelper extends AbstractBackendViewHelper
{
use CompileWithRenderStatic;
/**
* As this ViewHelper renders HTML, the output must not be escaped.
*
......@@ -46,18 +49,6 @@ class ErrorIconViewHelper extends AbstractBackendViewHelper
* Renders an error icon link as known from the TYPO3 backend.
* Error codes 2 and three are mapped to "error" and 1 is mapped to "warning".
*
* @return string the rendered error icon link
*/
public function render()
{
return static::renderStatic(
$this->arguments,
$this->buildRenderChildrenClosure(),
$this->renderingContext
);
}
/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
......
......@@ -202,15 +202,12 @@
</f:if>
</td>
<td>
<f:switch expression="{logItem.error}">
<f:case value="1">
<f:link.action action="deleteMessage" arguments="{errorUid:logItem.uid}" class="btn btn-warning"><f:translate key="actions.deleteWarnings" /></f:link.action>
</f:case>
<f:case value="2">
<f:link.action action="deleteMessage" arguments="{errorUid:logItem.uid}" class="btn btn-danger"><f:translate key="actions.delete" /></f:link.action>
</f:case>
<f:defaultCase />
</f:switch>
<f:if condition="{logItem.error} == 1">
<f:link.action action="deleteMessage" arguments="{errorUid:logItem.uid}" class="btn btn-warning"><f:translate key="actions.deleteWarnings" /></f:link.action>
</f:if>
<f:if condition="{logItem.error} == 2">
<f:link.action action="deleteMessage" arguments="{errorUid:logItem.uid}" class="btn btn-danger"><f:translate key="actions.delete" /></f:link.action>
</f:if>
</td>
</tr>
</f:for>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment