TYPO3 FlexForm Code Snippets & Tutorials

Master TYPO3 FlexForm with our helpful code snippets and tutorials. Streamline your content management process and enhance your website.

Here is the list of all available TYPO3 flexform code snippets & tutorials to learn how to use TYPO3 FlexForm.

This page collects TYPO3 FlexForm code snippets, for example a simple text input field, that you can copy into the FlexForm XML of your extension and adjust.


<!-- "type=text" simple textbox -->
<settings.text>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>input</type>
         <size>15</size>
         <eval></eval>
         <enableRichtext>0</enableRichtext>
      </config>
   </TCEforms>
</settings.text>

<!-- "type=text" simple textbox -->
<!-- <allowed>pages</allowed> You can change the link types from this configuration -->
<link>
    <TCEforms>
        <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.link
        </label>
        <config>
            <type>group</type>
            <internal_type>db</internal_type>
            <allowed>pages</allowed>
            <size>1</size>
            <minitems>0</minitems>
            <maxitems>1</maxitems>
            <show_thumbs>1</show_thumbs>
        </config>
    </TCEforms>
</link>

<!-- "type=check" Single checkbox -->
<settings.checkbox>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>check</type>
         <default>0</default>
      </config>
   </TCEforms>
</settings.checkbox>

<!-- "type=select" Simple dropdown -->
<settings.select>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>select</type>
         <items>
            <numIndex index="0" type="array">
               <numIndex index="0"></numIndex>
               <numIndex index="1"></numIndex>
            </numIndex>
            <numIndex index="1">
               <numIndLLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</numIndex>
               <numIndex index="1">tstamp</numIndex>
            </numIndex>
         </items>
      </config>
   </TCEforms>
</settings.select>

<!-- "type=group" Select pages -->
<settings.select_pages>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>group</type>
         <internal_type>db</internal_type>
         <allowed>pages</allowed>
         <size>3</size>
         <maxitems>50</maxitems>
         <minitems>0</minitems>
      </config>
   </TCEforms>
</settings.select_pages>

<!-- "type=group" Select custom extension records -->
<settings.custom_table>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>group</type>
         <internal_type>db</internal_type>
         <allowed>tx_table_name</allowed>
         <size>1</size>
         <maxitems>1</maxitems>
         <minitems>0</minitems>
      </config>
   </TCEforms>
</settings.custom_table>

<!-- "type=select" Draw categories tree -->
<settings.categories_tree>
   <TCEforms>
      <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_be.xlf:general.title</label>
      <config>
         <type>select</type>
         <renderMode>tree</renderMode>
         <renderType>selectTree</renderType>
         <treeConfig>
            <parentField>parent</parentField>
            <appearance>
               <maxLevels>99</maxLevels>
               <expandAll>TRUE</expandAll>
               <showHeader>TRUE</showHeader>
            </appearance>
         </treeConfig>
         <foreign_table>sys_category</foreign_table>
         <foreign_table_where>AND (sys_category.sys_language_uid = 0 OR sys_category.l10n_parent = 0) ORDER BY sys_category.sorting</foreign_table_where>
         <size>15</size>
         <minitems>0</minitems>
         <maxitems>99</maxitems>
      </config>
   </TCEforms>
</settings.categories_tree>

<!-- "type=inline" Configuration for Image [FAL] -->
<image>
    <TCEforms>
        <label>LLL:EXT:yourextension/Resources/Private/Language/locallang_flex.xlf:general.image</label>
        <config>
            <type>inline</type>
            <maxitems>1</maxitems>
            <foreign_table>sys_file_reference</foreign_table>
            <foreign_table_field>tablenames</foreign_table_field>
            <foreign_label>uid_local</foreign_label>
            <foreign_sortby>sorting_foreign</foreign_sortby>
            <foreign_field>uid_foreign</foreign_field>
            <foreign_selector>uid_local</foreign_selector>
            <foreign_selector_fieldTcaOverride>
                <config>
                    <appearance>
                        <elementBrowserType>file</elementBrowserType>
                        <elementBrowserAllowed>gif,jpg,jpeg,png,svg</elementBrowserAllowed>
                    </appearance>
                </config>
            </foreign_selector_fieldTcaOverride>
            <foreign_types type="array">
                <numIndex index="0">
                    <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                </numIndex>
                <numIndex index="2">
                    <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                </numIndex>
            </foreign_types>
            <foreign_match_fields>
                <fieldname>image</fieldname> <!-- CAUTION!! Replace "fal" with the variable name of this field! -->
            </foreign_match_fields>
            <appearance type="array">
                <newRecordLinkAddTitle>1</newRecordLinkAddTitle>
                <headerThumbnail>
                    <field>uid_local</field>
                    <height>64</height>
                    <width>64</width>
                </headerThumbnail>
                <enabledControls>
                    <info>1</info>
                    <new>0</new>
                    <dragdrop>0</dragdrop>
                    <sort>1</sort>
                    <hide>0</hide>
                    <delete>1</delete>
                    <localize>1</localize>
                </enabledControls>
                <createNewRelationLinkTitle>LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference</createNewRelationLinkTitle>
            </appearance>
            <behaviour>
                <localizationMode>select</localizationMode>
                <localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization>
            </behaviour>
            <overrideChildTca>
                <columns type="array">
                    <uid_local type="array">
                        <config type="array">
                            <appearance type="array">
                                <elementBrowserType>file</elementBrowserType>
                                <elementBrowserAllowed>jpg,png,svg,jpeg,gif</elementBrowserAllowed>
                            </appearance>
                        </config>
                    </uid_local>
                </columns>
                <types type="array">
                    <numIndex index="2">
                        <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                    </numIndex>
                </types>
            </overrideChildTca>
        </config>
    </TCEforms>
</image>
  • Copy the snippet you need into the FlexForm XML of your extension and adjust the label and field settings.
  • Labels can point to a language file with LLL:EXT: so that they can be translated.
  • To decide between FlexForm and TCA, read the comparison linked below.
  • Want AI support in the TYPO3 backend? See TYPO3 AI.

A configuration written in XML that defines settings for content elements and plugins.

Copy them into the FlexForm XML file of your extension and adjust them.

Point the label to a language file with an LLL:EXT: reference, as in the snippets on this page.

The page lists snippets for the available FlexForm field types, for example a simple text input.

Read our comparison TYPO3 FlexForm vs TCA to decide for your project.

You May Also Like