typo3flexform

TYPO3 FlexForm: how to disable field in inline element?


I have a TYPO3 plugin with a FlexForm. In the FlexForm I added relations to a foreign table. I now need to disable some of the fields of the foreign table. I can't do this via user rights since it's a question of context, not rights.

My FlexForm looks like this:

<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>

I thought about TCEFORM, but have no idea how to address the field:

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

Is there any possibility to disable a field via TSconfig or PHP?


Solution

  • This answer to a different question inspired me to the solution which finally solved my problem!

    foreign_types was the solution I was looking for:

    <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>