TYPO3 FlexForm:如何禁用内联元素中的字段?

TYPO3 FlexForm: how to disable field in inline element?

我有一个带有 FlexForm 的 TYPO3 插件。在 FlexForm 中,我将关系添加到外部 table。我现在需要禁用一些外国 table 的字段。我无法通过用户权限执行此操作,因为这是上下文问题,而不是权限问题。

我的 FlexForm 看起来像这样:

<settings.moreinfo>
    <TCEforms>
        <label>my label</label>
        <config>
            <type>inline</type>
            <foreign_table>tx_foo_domain_model_bar</foreign_table>
            <foreign_field>content_uid</foreign_field>
            <foreign_sortby>sorting</foreign_sortby>
            <maxitems>50</maxitems>
        </config>
    </TCEforms>
</settings.moreinfo>

我考虑过 TCEFORM,但不知道如何解决该字段:

TCEFORM.tt_content.pi_flexform.foobar.general {
  settings\.moreinfo {
    # maybe here?
  }
}

是否可以通过 TSconfig 或 PHP 禁用字段?

一般来说,您可以禁用 flexform 字段。 manual 说明了可能性:

Other properties also apply to flex form fields, in this case the full property path including the data structure key has to be set:
TCEFORM.[tableName].[fieldName].[dataStructureKey].[flexSheet].[flexFieldName].[propertyName].
The [dataStructKey] represents the key of a FlexForm in $GLOBALS['TCA'][<tableName>]['columns'][<field>]['config']['ds']. This key will be split into up to two parts. By default the first part will be used as identifier of the FlexForm in TSconfig. The second part will override the identifier if it is not empty, list or *.
For example the identifier of the key my_ext_pi1,list will be my_ext_pi1 and of the key *,my_CType it will be my_CType. See section Pointing to a data structure of the TCA reference for details.

Some properties apply to whole FlexForm sheets, their property path is TCEFORM.[tableName].[fieldName].[dataStructureKey].[flexSheet].[propertyName].

如果在标识符中使用 . 可能会出现问题。

启发了我最终解决了我的问题的解决方案!

foreign_types 是我正在寻找的解决方案:

<settings.moreinfo>
    <TCEforms>
        <label>my label</label>
        <config>
            <type>inline</type>
            <foreign_table>tx_foo_domain_model_bar</foreign_table>
            <foreign_field>content_uid</foreign_field>
            <foreign_sortby>sorting</foreign_sortby>
            <maxitems>50</maxitems>
            <foreign_types type="array">
                <numIndex index="1" type="array">
                    <showitem>
                        title, link, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, hidden;;1, starttime, endtime
                    </showitem>
                </numIndex>
            </foreign_types>
        </config>
    </TCEforms>
</settings.moreinfo>