首页 文章

TYPO3 Extbase:为后端模块设置storagepid

提问于
浏览
0

我写了一个小扩展,为Backend User提供新闻 . 我只是2部分 . 一部分显示所有BE用户作为自己的模块的消息,另一部分是由TCA提供的创建和编辑功能 .

要使用TCA表单和默认的extbase getter,我需要正确的storagePid . 我无法通过TypoScript设置它们,因为 I'm never in a page context .

我的想法是使用插件设置和文件 ext_conf_template.txt

# cat=persistence/enable; type=int; label=Storage pid
storagePid = 4457

settings

但是,如何告诉TYPO3查看此设置?

至少 Repository->findAll() 必须尊重它

2 回答

  • 2

    通常你会使用TypoScript定义它:

    module.tx_yourextensionkey.persistence.storagePid = 123
    

    只要将配置放在第一个根TypoScript模板上(或通过其他方式包含TypoScript,导致全局包含不特定于任何 sys_template 记录或页面树位置),不在页面上下文中就不是阻止程序 .

  • 0

    也许不是最好的解决方案,但它确实有效 .

    我已经使用pid作为参数在存储库中编写了我自己的函数 . 我正在使用TYPO3查询构建器 .
    随着 $query->equals('pid', $pid); 我得到了我的pid条目 .
    使用 $query->getQuerySettings()->setRespectStoragePage(false); 将忽略默认的pid .

    并作为最后一步 . 我的控制器从设置中获取pid, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']); 将其提供给该功能 .

相关问题