Fix backend preview rendering for video CE

The ContentDataProcessor got a constructor argument.
We migrated to proper DI to not care.
This commit is contained in:
Daniel Siepmann 2021-12-15 08:41:52 +01:00
parent 7d2b8e8b07
commit def2aabcad
3 changed files with 30 additions and 33 deletions

View file

@ -29,6 +29,14 @@ use TYPO3\CMS\Frontend\DataProcessing\FilesProcessor;
class Video extends StandardContentPreviewRenderer class Video extends StandardContentPreviewRenderer
{ {
private ContentDataProcessor $contentDataProcessor;
public function __construct(
ContentDataProcessor $contentDataProcessor
) {
$this->contentDataProcessor = $contentDataProcessor;
}
public function renderPageModulePreviewContent(GridColumnItem $item): string public function renderPageModulePreviewContent(GridColumnItem $item): string
{ {
$record = $item->getRecord(); $record = $item->getRecord();
@ -36,7 +44,7 @@ class Video extends StandardContentPreviewRenderer
$contentObjectRenderer = new ContentObjectRenderer(); $contentObjectRenderer = new ContentObjectRenderer();
$contentObjectRenderer->start($record, 'tt_content'); $contentObjectRenderer->start($record, 'tt_content');
$record = (new ContentDataProcessor())->process($contentObjectRenderer, [ $record = $this->contentDataProcessor->process($contentObjectRenderer, [
'dataProcessing.' => [ 'dataProcessing.' => [
'10' => FilesProcessor::class, '10' => FilesProcessor::class,
'10.' => [ '10.' => [

View file

@ -21,6 +21,9 @@ services:
DanielSiepmann\DsSite\Frontend\RssFeed\XmlSitemapRenderer: DanielSiepmann\DsSite\Frontend\RssFeed\XmlSitemapRenderer:
public: true public: true
DanielSiepmann\DsSite\Backend\PreviewRenderer\Video:
public: true
DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts: DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts:
public: true public: true
arguments: arguments:

View file

@ -1,41 +1,27 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers" xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
data-namespace-typo3-fluid="true"> data-namespace-typo3-fluid="true">
<f:for each="{videos}" as="video">
<figure>
<video controls {f:if(condition: video.properties.poster.publicUrl, then: 'poster="{video.properties.poster.publicUrl}"')}>
<source src="{video.publicUrl}" type="video/mp4">
</video>
<figcaption>
<a href="{be:uri.editRecord( <a href="{be:uri.editRecord(
uid: uid, uid: uid,
table: 'tt_content' table: 'tt_content'
)}"> )}">
<f:for each="{videos}" as="video">
<figure>
<video controls preload="metadata">
<source src="/{video.publicUrl}" type="video/mp4">
</video>
<figcaption>
<p>Video v{video.originalFile.uid}: {video.title}</p>
<p> <p>
Video v{video.originalFile.uid}: {video.title}<br>
Size: {video.size -> f:format.bytes(decimals: 2)}
<f:if condition="{video.properties.youtube}"> <f:if condition="{video.properties.youtube}">
<f:then> <br>
The Video is available on YouTube: <f:link.typolink parameter="https://www.youtube.com/watch?v=EZkwnqb-4vk" target="_blank">https://www.youtube.com/watch?v={video.properties.youtube}</f:link.typolink>. YouTube: {video.properties.youtube}
</f:then>
<f:else>
The Video is not available on YouTube
</f:else>
</f:if> </f:if>
</p> </p>
<p>{video.description -> f:format.nl2br()}</p> <p>{video.description -> f:format.nl2br()}</p>
</a>
<p>
<f:if condition="{video.properties.poster}">
<f:then>
<f:image image="{video.properties.poster}" height="210" width="375" />
</f:then>
<f:else>
No poster configured.
</f:else>
</f:if>
</p>
</figcaption> </figcaption>
</figure> </figure>
</f:for> </f:for>
</a>
</html> </html>