Add media to backend info for fast access

This commit is contained in:
Daniel Siepmann 2019-12-13 13:36:02 +01:00
parent 0feb7c46fd
commit 2673fd7620
3 changed files with 32 additions and 0 deletions

View file

@ -24,6 +24,7 @@ namespace DanielSiepmann\DsSite\Hooks\View;
use TYPO3\CMS\Backend\View\PageLayoutView as Typo3PageLayoutView;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Frontend\Resource\FileCollector;
/**
* Holds all TYPO3 Hooks for PageLayoutView class.
@ -72,6 +73,12 @@ class PageLayoutView
'value' => $this->layoutView->pageRecord['SYS_LASTCHANGED'],
'type' => 'date',
],
[
'label' => 'media',
'value' => $this->resolvePageMedia(),
'field' => 'media',
'type' => 'files',
],
],
]);
$view->setTemplatePathAndFilename('EXT:ds_site/Resources/Private/Templates/Backend/Page/MetaInfo.html');
@ -83,4 +90,13 @@ class PageLayoutView
{
return GeneralUtility::makeInstance(StandaloneView::class);
}
private function resolvePageMedia(): array
{
$page = ['uid' => $this->layoutView->pageRecord['uid']];
$files = new FileCollector();
$files->addFilesFromRelation('pages', 'media', $page);
return $files->getFiles();
}
}

View file

@ -15,6 +15,9 @@
<trans-unit id="backend.page.metainfo.updated">
<source>Updated (SYS_LASTCHANGED)</source>
</trans-unit>
<trans-unit id="backend.page.metainfo.media">
<source>Images (media)</source>
</trans-unit>
</body>
</file>
</xliff>

View file

@ -35,6 +35,19 @@
</f:if>
</f:section>
<f:section name="Value-files">
<f:if condition="{value}">
<f:then>
<f:for each="{value}" as="file">
<f:image image="{file}" maxWidth="500" maxHeight="500" />
</f:for>
</f:then>
<f:else>
{f:translate(id: 'backend.page.metainfo.notSet', extensionName: 'DsSite')}
</f:else>
</f:if>
</f:section>
<f:section name="Link">
{f:uri.editRecord(
uid: recordUid,