TYPO3 StoragePid and Current

2019-02-20 11:27发布

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>

"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 = ?
}

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

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

2条回答
Bombasti
2楼-- · 2019-02-20 12:06

persistence.storagePid.field = uid

All fields of "report" which gets passed along with "report -> f:cObject" will be available to stdWrap property ".field".

You could also do

persistence.storagePid.debugData = 1

to list all available fields of $cObj->data

查看更多
【Aperson】
3楼-- · 2019-02-20 12:23

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

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

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

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

$currentUid = $GLOBALS['TSFE']->id;
查看更多
登录 后发表回答