TYPO3 Extbase:为后端模块设置storagepid [英] TYPO3 Extbase: Set storagepid for Backend Module
问题描述
我写了一个小扩展程序,为后端用户提供新闻. Ist只是2个部分.一部分显示所有BE用户作为一个独立模块的新闻,另一部分则是TCA提供的创建和编辑功能.
I have written a small extension that provide news for Backend User. Ist is just 2 Parts. One part showing the news for all BE User as a own Module, and the other part are create and edit functions provided by the TCA.
要使用TCA表单和默认的extbase getter,我需要正确的storagePid.我无法通过TypoScript设置它们,因为我从不在页面上下文中.
To work with the TCA forms and the default extbase getter, i need the correct storagePid. I can't set them via TypoScript, because I'm never in a page context.
我的想法是将插件设置与文件ext_conf_template.txt
My Idea was to use the Plugin settings with the file ext_conf_template.txt
# cat=persistence/enable; type=int; label=Storage pid
storagePid = 4457
但是如何告诉TYPO3查看此设置?
But how can I tell TYPO3 to look at this Settings?
至少Repository->findAll()
必须遵守
推荐答案
也许不是最好的解决方案,但它可行.
Maybe not the best solution, but it works.
我已经使用pid作为参数在存储库中编写了自己的函数.
我正在使用TYPO3查询构建器.
使用$query->equals('pid', $pid);
可以获得我的pid条目.
使用$query->getQuerySettings()->setRespectStoragePage(false);
时,默认pid将被忽略.
I have written my own function in the repository with the pid as parameter.
I'm using the TYPO3 Query builder.
With $query->equals('pid', $pid);
I get entries with my pid.
And with $query->getQuerySettings()->setRespectStoragePage(false);
the default pid will be ignored.
最后一步.我的控制器从设置"中获取该pid,unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']);
将其提供给该功能.
And as the last step. My Controller gets the pid from the Settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']);
an gives it to the function.
这篇关于TYPO3 Extbase:为后端模块设置storagepid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!