|
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
|
|
|
declare(strict_types=1); |
|
16
|
|
|
|
|
17
|
|
|
namespace HDNET\Calendarize\ViewHelpers; |
|
18
|
|
|
|
|
19
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
|
20
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; |
|
21
|
|
|
|
|
22
|
|
|
class IconForRecordViewHelper extends \TYPO3\CMS\Core\ViewHelpers\IconForRecordViewHelper |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Initializes the arguments |
|
27
|
|
|
*/ |
|
28
|
|
|
public function initializeArguments() |
|
29
|
|
|
{ |
|
30
|
|
|
parent::initializeArguments(); |
|
31
|
|
|
$this->registerArgument('uid', 'int', '', true); |
|
32
|
|
|
$this->overrideArgument('row', 'array', 'the record row', false); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param array $arguments |
|
37
|
|
|
* @param \Closure $renderChildrenClosure |
|
38
|
|
|
* @param RenderingContextInterface $renderingContext |
|
39
|
|
|
* @return string |
|
40
|
|
|
*/ |
|
41
|
|
|
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
|
42
|
|
|
{ |
|
43
|
|
|
$arguments['row'] = BackendUtility::getRecord($arguments['table'], $arguments['uid']); |
|
44
|
|
|
if (!is_array($arguments['row'])) { |
|
45
|
|
|
$arguments['row'] = []; |
|
46
|
|
|
} |
|
47
|
|
|
return parent::renderStatic($arguments, $renderChildrenClosure, $renderingContext); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|