‪TYPO3CMS  ‪main
IconForRecordViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 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 
21 use TYPO3\CMS\Core\Imaging\IconSize;
23 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
24 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
25 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
26 
45 final class ‪IconForRecordViewHelper extends AbstractViewHelper
46 {
47  use CompileWithRenderStatic;
48 
54  protected ‪$escapeOutput = false;
55 
56  public function ‪initializeArguments(): void
57  {
58  $this->registerArgument('table', 'string', 'the table for the record icon', true);
59  $this->registerArgument('row', 'array', 'the record row', true);
60  $this->registerArgument('size', 'string', 'the icon size', false, IconSize::SMALL);
61  $this->registerArgument('alternativeMarkupIdentifier', 'string', 'alternative markup identifier', false);
62  }
63 
64  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
65  {
66  $table = $arguments['table'];
67  $size = $arguments['size'];
68  $row = $arguments['row'];
69  $alternativeMarkupIdentifier = $arguments['alternativeMarkupIdentifier'];
70  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
71  return $iconFactory->getIconForRecord($table, $row, $size)->render($alternativeMarkupIdentifier);
72  }
73 }
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper
Definition: IconForRecordViewHelper.php:46
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\renderStatic
‪static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: IconForRecordViewHelper.php:62
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: IconForRecordViewHelper.php:52
‪TYPO3\CMS\Core\ViewHelpers
Definition: IconForRecordViewHelper.php:18
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\initializeArguments
‪initializeArguments()
Definition: IconForRecordViewHelper.php:54
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52