TYPO3 CMS  TYPO3_7-6
SpriteIconForRecordViewHelper.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 
24 
30 {
39  public function render($table, $object)
40  {
41  return static::renderStatic(
42  [
43  'table' => $table,
44  'object' => $object
45  ],
47  $this->renderingContext
48  );
49  }
50 
60  {
61  $object = $arguments['object'];
62  $table = $arguments['table'];
63 
64  if (!is_object($object) || !method_exists($object, 'getUid')) {
65  return '';
66  }
67  $row = [
68  'uid' => $object->getUid(),
69  'startTime' => false,
70  'endTime' => false
71  ];
72  if (method_exists($object, 'getIsDisabled')) {
73  $row['disable'] = $object->getIsDisabled();
74  }
75  if (method_exists($object, 'getHidden')) {
76  $row['hidden'] = $object->getHidden();
77  }
78  if ($table === 'be_users' && $object instanceof BackendUser) {
79  $row['admin'] = $object->getIsAdministrator();
80  }
81  if (method_exists($object, 'getStartDateAndTime')) {
82  $row['startTime'] = $object->getStartDateAndTime();
83  }
84  if (method_exists($object, 'getEndDateAndTime')) {
85  $row['endTime'] = $object->getEndDateAndTime();
86  }
88  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
89  return $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render();
90  }
91 }
static renderStatic(array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)