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