|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
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
|
|
|
|
|
18
|
|
|
namespace TYPO3\CMS\Frontend\Preview; |
|
19
|
|
|
|
|
20
|
|
|
use TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer; |
|
21
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
|
22
|
|
|
use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Contains a preview rendering for the page module of CType="image" |
|
26
|
|
|
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:frontend and not part of TYPO3's Core API. |
|
27
|
|
|
*/ |
|
28
|
|
|
class ImagePreviewRenderer extends StandardContentPreviewRenderer |
|
29
|
|
|
{ |
|
30
|
|
|
public function renderPageModulePreviewContent(GridColumnItem $item): string |
|
31
|
|
|
{ |
|
32
|
|
|
$row = $item->getRecord(); |
|
33
|
|
|
$content = $this->linkEditContent(BackendUtility::thumbCode($row, 'tt_content', 'image', '', '', null, 0, '', '', false), $row); |
|
34
|
|
|
|
|
35
|
|
|
$fileReferences = BackendUtility::resolveFileReferences('tt_content', 'image', $row); |
|
36
|
|
|
|
|
37
|
|
|
if (!empty($fileReferences)) { |
|
38
|
|
|
$linkedContent = ''; |
|
39
|
|
|
|
|
40
|
|
|
foreach ($fileReferences as $fileReference) { |
|
41
|
|
|
$description = $fileReference->getDescription(); |
|
42
|
|
|
if ($description !== null && $description !== '') { |
|
43
|
|
|
$linkedContent .= htmlspecialchars($description) . '<br />'; |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
$content .= $this->linkEditContent($linkedContent, $row); |
|
48
|
|
|
} |
|
49
|
|
|
return $content; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|