‪TYPO3CMS  10.4
IconForRecordViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
24 
43 class ‪IconForRecordViewHelper extends AbstractViewHelper
44 {
45  use CompileWithRenderStatic;
46 
52  protected ‪$escapeOutput = false;
53 
57  public function ‪initializeArguments()
58  {
59  $this->registerArgument('table', 'string', 'the table for the record icon', true);
60  $this->registerArgument('row', 'array', 'the record row', true);
61  $this->registerArgument('size', 'string', 'the icon size', false, ‪Icon::SIZE_SMALL);
62  $this->registerArgument('alternativeMarkupIdentifier', 'string', 'alternative markup identifier', false, null);
63  }
64 
71  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
72  {
73  $table = $arguments['table'];
74  $size = $arguments['size'];
75  $row = $arguments['row'];
76  $alternativeMarkupIdentifier = $arguments['alternativeMarkupIdentifier'];
78  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
79  return $iconFactory->getIconForRecord($table, $row, $size)->render($alternativeMarkupIdentifier);
80  }
81 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper
Definition: IconForRecordViewHelper.php:44
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: IconForRecordViewHelper.php:69
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: IconForRecordViewHelper.php:50
‪TYPO3\CMS\Core\ViewHelpers
‪TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper\initializeArguments
‪initializeArguments()
Definition: IconForRecordViewHelper.php:55
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46