TYPO3:为插件Flexform覆写RTE CKEditor配置预设
TYPO3 Flexform字段无法应用CKEditor极简预设的问题
在TYPO3站点包扩展中配置了两个CKEditor预设:默认预设MyDefaultCKConfig和选项更少的极简预设MyMinimalCKConfig。常规tt_content字段及其他扩展的RTE文本字段都能正常应用极简预设,但插件Flexform中的文本字段无法生效。尝试按照官方文档的格式配置RTE.config.tt_content.settings.flexform.textAdd.preset,但未达到预期效果。
原page.tsconfig配置
RTE { default.preset = MyDefaultCKConfig config { tx_another_extension_model_xyz { ## 此配置生效 field_name.preset = MyMinimalCKConfig another_field_name.preset = MyMinimalCKConfig } ## 以下配置无效 tt_content.settings.flexform.textAdd.preset = MyMinimalCKConfig } }
插件Flexform定义(节选)
<settings.flexform.textAdd> <TCEforms> <exclude>1</exclude> <label>LLL:EXT:tx_another_extension/Resources/Private/Language/locallang_be.xlf:flexform.pluginName.textAdd</label> <config> <type>text</type> <cols>40</cols> <rows>5</rows> <enableRichtext>true</enableRichtext> </config> </TCEforms> </settings.flexform.textAdd>
问题原因与修复方案
错误出在RTE配置的路径上:TYPO3中tt_content的插件Flexform字段实际存储在pi_flexform字段中,且必须指定插件的CType(注册插件时定义的CType值)才能正确定位到对应Flexform字段。
正确配置示例
RTE { default.preset = MyDefaultCKConfig config { tx_another_extension_model_xyz { field_name.preset = MyMinimalCKConfig another_field_name.preset = MyMinimalCKConfig } tt_content { pi_flexform { # 替换为你的插件实际CType,比如"my_custom_plugin" your_plugin_ctype { settings.flexform.textAdd.preset = MyMinimalCKConfig } } } } }
注意事项
- 替换
your_plugin_ctype为插件真实的CType值(可在Configuration/TCA/Overrides/tt_content.php的插件注册代码中找到) - Flexform字段路径需与XML定义的字段名完全匹配,此处为
settings.flexform.textAdd
内容的提问来源于stack exchange,提问作者clive beckett
相关产品推荐
相关产品推荐

