TYPO3 CMS  TYPO3_8-7
RenderContentElementPreviewViewHelper.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
24 
33 {
35 
41  protected $escapeOutput = false;
42 
48  public function initializeArguments()
49  {
50  parent::initializeArguments();
51  $this->registerArgument('contentElementUid', 'int', 'The uid of a content element');
52  }
53 
61  public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
62  {
63  $content = '';
64  $contentElementUid = $arguments['contentElementUid'];
65  $contentRecord = BackendUtility::getRecord('tt_content', $contentElementUid);
66  if (!empty($contentRecord)) {
67  $pageLayoutView = GeneralUtility::makeInstance(PageLayoutView::class);
68  $content = $pageLayoutView->tt_content_drawItem($contentRecord);
69  }
70  return $content;
71  }
72 }
static makeInstance($className,... $constructorArguments)
static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)