‪TYPO3CMS  9.5
TextmediaPreviewRenderer.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 
26 {
36  public function ‪preProcess(
37  ‪PageLayoutView &$parentObject,
38  &$drawItem,
39  &$headerContent,
40  &$itemContent,
41  array &$row
42  ) {
43  if ($row['CType'] === 'textmedia') {
44  if ($row['bodytext']) {
45  $itemContent .= $parentObject->‪linkEditContent($parentObject->‪renderText($row['bodytext']), $row) . '<br />';
46  }
47 
48  if ($row['assets']) {
49  $itemContent .= $parentObject->‪linkEditContent($parentObject->‪getThumbCodeUnlinked($row, 'tt_content', 'assets'), $row) . '<br />';
50 
51  $fileReferences = ‪BackendUtility::resolveFileReferences('tt_content', 'assets', $row);
52 
53  if (!empty($fileReferences)) {
54  $linkedContent = '';
55 
56  foreach ($fileReferences as $fileReference) {
57  $description = $fileReference->getDescription();
58  if ($description !== null && $description !== '') {
59  $linkedContent .= htmlspecialchars($description) . '<br />';
60  }
61  }
62 
63  $itemContent .= $parentObject->‪linkEditContent($linkedContent, $row);
64 
65  unset($linkedContent);
66  }
67  }
68 
69  $drawItem = false;
70  }
71  }
72 }
‪TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface
Definition: PageLayoutViewDrawItemHookInterface.php:22
‪TYPO3\CMS\Backend\Utility\BackendUtility\resolveFileReferences
‪static TYPO3 CMS Core Resource FileReference[] null resolveFileReferences($tableName, $fieldName, $element, $workspaceId=null)
Definition: BackendUtility.php:1267
‪TYPO3\CMS\Frontend\Hooks\PageLayoutView\TextmediaPreviewRenderer
Definition: TextmediaPreviewRenderer.php:26
‪TYPO3\CMS\Frontend\Hooks\PageLayoutView
Definition: ImagePreviewRenderer.php:2
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\View\PageLayoutView\renderText
‪string renderText($input)
Definition: PageLayoutView.php:2646
‪TYPO3\CMS\Frontend\Hooks\PageLayoutView\TextmediaPreviewRenderer\preProcess
‪preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
Definition: TextmediaPreviewRenderer.php:36
‪TYPO3\CMS\Backend\View\PageLayoutView
Definition: PageLayoutView.php:61
‪TYPO3\CMS\Backend\View\PageLayoutView\linkEditContent
‪string linkEditContent($str, $row)
Definition: PageLayoutView.php:2430
‪TYPO3\CMS\Backend\View\PageLayoutView\getThumbCodeUnlinked
‪string getThumbCodeUnlinked($row, $table, $field)
Definition: PageLayoutView.php:2809