Ralf
Ralf

Reputation: 866

TYPO3 Extbase Flexform: Get selected flexform value for foreign_table_where

Is it possible to get the selected flexform value to customize the following select box? For example, I have a plugin where I have to select the type with a select box. Then the second select box appears, called kategorie, which is based on the selected type.

Pseudo code

<settings.type>
    <TCEforms>
        <onChange>reload</onChange>
        <label>Type</label>
        <config>
            <type>select</type>
            <renderType>selectSingle</renderType>
            <items type="array">
            </items>
            <size>1</size>
            <minitems>1</minitems>
            <maxitems>1</maxitems>
            <foreign_table>tx_test_domain_model_type</foreign_table>
        </config>
    </TCEforms>
</settings.type>
<settings.category>
    <TCEforms>
        <label>Category</label>
        <config>
            <type>select</type>
            <renderType>selectSingle</renderType>
            <items type="array">
            </items>
            <size>1</size>
            <minitems>1</minitems>
            <maxitems>1</maxitems>
            <foreign_table>tx_test_domain_model_category</foreign_table>
            <foreign_table_where> AND tx_test_domain_model_categorie.type = ###REC_FIELD_?settings.type?###</foreign_table_where>
        </config>
    </TCEforms>
</settings.category>

Thank you for help. I'm using TYPO3 7.6.14.

Upvotes: 1

Views: 2555

Answers (1)

cweiske
cweiske

Reputation: 31088

Flexform settings are stored as XML in one field the database. To read a value from it, you have to parse the XML first.

So it's not possible to use something like ###REC_FIELD_settings.type###.

There is a blog post that suggests using a custom itemsProcFunc for this: https://blog.bartlweb.net/2012/10/auswahllisten-im-typo3-backend-optimieren/

Upvotes: 1

Related Questions