How to get flexform value to controller that use for backend module?

698 views Asked by At

I am stuck in one place. i developing an extension in typo3. I used flexform for admin. Now I try to fetch that flexform value in controller for backend module but i get "Null" every time. Same value i try for frontend module that time i can fetch value.

Below is my flexform code:

<T3DataStructure>
    <meta>
        <langDisable>1</langDisable>
    </meta>
    <sheets>
        <sCategorybox>
            <ROOT>
                <TCEforms>
                    <sheetTitle>XY</sheetTitle>
                </TCEforms>
                <type>array</type>
                <el>
                    <settings.cat1>
                        <TCEforms>
                         <exclude>1</exclude>
                         <label>XYZ</label>
                         <config>
                          <type>select</type>
                            <renderType>selectMultipleSideBySide</renderType>
                            <size>5</size>

                            <foreign_table>tx_myext</foreign_table>
                            <foreign_table_where> AND tx_myext.hidden = 0 AND tx_myext.deleted = 0 ORDER BY name ASC</foreign_table_where>
                         </config>
                        </TCEforms>
                    </settings.cat1>
                </el>
            </ROOT>
        </sCategorybox>
    </sheets>

</T3DataStructure>

In Controller's action i tried like this $this->settings['cat1'];

Flexform is used for the backend where admin can select category when admin add extension to page.

extension also have backend module and seprate action for backend module, I want that selected category value in that action.

1

There are 1 answers

0
Jonas Eberle On

This looks like a FlexForm for a plugin.

An Extbase action inside this plugin context in the frontend will fill the settings from the tt_content.pi_flexform column (if they are, as you did, called settings. ...).

In the backend you are not inside the plugin context. As such you need to fetch the column pi_flexform and read out the XML structure yourself.

\TYPO3\CMS\Core\Service\FlexFormService has some functions that can help you with parsing the XML.