‪TYPO3CMS  ‪main
UserContentObject.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 
18 use Psr\Log\LogLevel;
21 
26 {
33  public function ‪render($conf = [])
34  {
35  if (!is_array($conf) || empty($conf)) {
36  $this->‪getTimeTracker()->‪setTSlogMessage('USER without configuration.', LogLevel::WARNING);
37  return '';
38  }
39  $content = '';
40  if ($this->cObj->getUserObjectType() === false) {
41  // Come here only if we are not called from $TSFE->processNonCacheableContentPartsAndSubstituteContentMarkers()!
42  $this->cObj->setUserObjectType(‪ContentObjectRenderer::OBJECTTYPE_USER);
43  }
44  $tempContent = $this->cObj->callUserFunction($conf['userFunc'] ?? '', $conf, '');
45  if ($this->cObj->doConvertToUserIntObject) {
46  $this->cObj->doConvertToUserIntObject = false;
47  $content = $this->cObj->cObjGetSingle('USER_INT', $conf);
48  } else {
49  $content .= $tempContent;
50  // Only executed when the element is not converted to USER_INT
51  if (isset($conf['stdWrap.'])) {
52  $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
53  }
54  }
55  $this->cObj->setUserObjectType(false);
56  return $content;
57  }
58 
62  protected function ‪getTimeTracker()
63  {
64  return GeneralUtility::makeInstance(TimeTracker::class);
65  }
66 }
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\OBJECTTYPE_USER
‪const OBJECTTYPE_USER
Definition: ContentObjectRenderer.php:366
‪TYPO3\CMS\Frontend\ContentObject
Definition: AbstractContentObject.php:18
‪TYPO3\CMS\Frontend\ContentObject\UserContentObject\render
‪string render($conf=[])
Definition: UserContentObject.php:33
‪TYPO3\CMS\Frontend\ContentObject\UserContentObject
Definition: UserContentObject.php:26
‪TYPO3\CMS\Frontend\ContentObject\AbstractContentObject
Definition: AbstractContentObject.php:31
‪TYPO3\CMS\Frontend\ContentObject\UserContentObject\getTimeTracker
‪TimeTracker getTimeTracker()
Definition: UserContentObject.php:62
‪TYPO3\CMS\Core\TimeTracker\TimeTracker\setTSlogMessage
‪setTSlogMessage(string $content, string $logLevel=LogLevel::INFO)
Definition: TimeTracker.php:143
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\TimeTracker\TimeTracker
Definition: TimeTracker.php:34