[英]TYPO3 Neos - Access Media Management files through TypoScript?
is it possible to access files uploaded in the media management using typoscript in TYPO3 Neos? TYPO3 Neos中的打字错误可以访问在媒体管理中上传的文件吗? I'm trying to create a site listing all pdfs uploaded by the editors, but I couldn't figure out a way to access these pdfs via typoscript.
我正在尝试创建一个列出所有由编辑者上传的pdf的站点,但是我想不出一种通过错字来访问这些pdf的方法。
It is currently (state of Neos 1.2 beta) not possible to gather a list of assets with the built-in TypoScript objects / Eel helpers. 当前(Neos 1.2 beta版)无法使用内置的TypoScript对象/ Eel帮助器来收集资产列表。 There are two ways to implement your requirement:
有两种方法可以实现您的要求:
A plugin can be created following the guide on the Neos documentation . 可以按照Neos文档上的指南创建插件。 If you want to render the list via TypoScript, it's easy to create such a TypoScript object in your own site package:
如果要通过TypoScript呈现列表,可以在自己的站点包中创建这样的TypoScript对象很容易:
use TYPO3\Flow\Annotations as Flow;
class AssetCollection extends \TYPO3\TypoScript\TypoScriptObjects\AbstractTypoScriptObject {
/**
* @Flow\Inject
* @var \TYPO3\Media\Domain\Repository\AssetRepository
*/
protected $assetRepository;
public function evaluate() {
return $this->assetRepository->findAll();
}
}
And then use that new object in TypoScript: 然后在TypoScript中使用该新对象:
prototype(TYPO3.NeosDemoTypo3Org:AssetCollection) {
@class = 'TYPO3\\NeosDemoTypo3Org\\TypoScriptObjects\\AssetCollection'
}
page.body.assets = TYPO3.NeosDemoTypo3Org:AssetCollection
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.