将TYPO3 extbase storagePageIds/storagePid设置为current [英] Set TYPO3 extbase storagePageIds / storagePid to current

查看:53
本文介绍了将TYPO3 extbase storagePageIds/storagePid设置为current的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用依赖于extbase的TYPO3扩展feupload.这是我第一次接触extbase. 但是问题通常是关于extbase的.

I am using the TYPO3 extension feupload, which relies on extbase. This is my first contact with extbase. But the question is about extbase in general.

我希望TYPO3默认情况下在查询中包括通常的"IN(当前页)" pid检查,除非另有说明-但在extbase中似乎有所不同.或者至少就我而言,它不起作用.

I expect TYPO3 to include the usual "IN (current-page)" pid check by default in queries, unless told otherwise - but in extbase that seems to be different. Or at least in my case, it's not working.

在扩展名中,有一个常量/设置设置,可以在其中设置storagePid.这行得通. 但是我们不想为每个页面手动调整该参数.

In the extension, there is a constants / setup setting, where the storagePid can be set. This works. But we don't want to adapt that parameter manually for each page.

persistence {
       # cat=feupload/persistence; type=integer; label=Storage PID of records
       storagePid =
}

那么如何使extbase像预期的那样自动获取当前页面的PID?

So how do I make extbase get the PID of the current page automatically as expected?

(子问题:我试图在安装程序中设置plugin.tx_pluginname.persistence.storagePid.data = {page:uid},但这行不通.TS必须看起来像什么? )

(Sub-question: I've tried to set plugin.tx_pluginname.persistence.storagePid.data = {page:uid} in setup, but that wouldn't work. What would the TS have to look like to work?)

推荐答案

好,应该起作用,但是必须这样写:

Well, what you did should work, but you have to write it like this:

plugin.tx_pluginname.persistence.storagePid.data = page:uid

({}仅在普通包装中插入数据字段时才是必需的)

(the {} is only necessary when you insert a data field in an ordinary wrap)

正如其他人指出的那样,您必须确保在模板中包括扩展程序的配置.

As others pointed out, you have to make sure you include the extension's configuration in your template.

如果上述操作失败,则可以在控制器的initializeAction中以编程方式设置storagePid,如下所示:

If the above fails, you can programatically set the storagePid in your controller's initializeAction, like so:

$querySettings = $this->myRepository->createQuery()->getQuerySettings();
$querySettings->setStoragePageIds(array($GLOBALS["TSFE"]->id));
$this->myRepository->setDefaultQuerySettings($querySettings);

这篇关于将TYPO3 extbase storagePageIds/storagePid设置为current的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆