TYPO3 StoragePid和当前 [英] TYPO3 StoragePid and Current

查看:83
本文介绍了TYPO3 StoragePid和当前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个简单的注释extbase扩展,我想在项目扩展名(也包括extbase)中将其与排印字一起添加.项目扩展中的流畅代码如下所示:

i build a simple commentary extbase extension, which i want to include with typoscript in a project extension (also extbase). The fluid code in the project extension looks like this:

<f:for each="{project.reports}" as="report">
    ...Content...
    {report -> f:cObject(typoscriptObjectPath: 'lib.comments')}
</f:for>

报告"是ID的数组. lib.comments打字稿看起来像这样:

"Reports" is an array of id's. The lib.comments typoscript looks like this:

lib.comments = USER
lib.comments  {
    userFunc = tx_extbase_core_bootstrap->run
    extensionName = Comments
    pluginName = Comments
    persistence.storagePid = ?
}

StoragePid应该与报告ID相匹配,所以我尝试了: persistence.storagePid.cObject =文本 persistence.storagePid.cObject.current = 1

The StoragePid should match with the report id, so i tried: persistence.storagePid.cObject = TEXT persistence.storagePid.cObject.current = 1

但是它不起作用.有谁知道,这是将storagePid设置为当前"的正确方法吗?

But it doens't work. Has anyone an idea, which is the right way to set "current" to the storagePid?

推荐答案

您可以通过在存储库的开头放置方法来禁用存储PID的检查:

You can disable storage PID checking in your repository by placing method at its beginning:

public function initializeObject() {
    $this->defaultQuerySettings->setRespectStoragePage(FALSE);
}

然后使用当前页面的id作为公共参数并将其作为公共约束传递给存储库查找器.

Then use id of current page by passing it to the repositories finder as common param and including as common constraint.

您当然可以像往常一样使用以下方法获取当前页面的UID:

of course current page's UID you fetches as usual with:

$currentUid = $GLOBALS['TSFE']->id;

这篇关于TYPO3 StoragePid和当前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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