0

I am still trying to tranform the TCA definition to an Flexform XML definition. I am working with T3 11.5.25. In T3 12 this is - as far as I know - deprecated and replaced by "type=file". But this is not available in T3 11.

        'icon_file' => [
            'label' => 'LLL:EXT:bootstrap_package/Resources/Private/Language/Backend.xlf:field.icon_file',
            'displayCond' => 'FIELD:icon_set:REQ:false',
            'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'icon_file',
                [
                    'appearance' => [
                        'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
                    ],
                    'overrideChildTca' => [
                        'types' => [
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_UNKNOWN => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                            \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
                                'showitem' => '
                                    --palette--;;filePalette
                                '
                            ],
                        ],
                    ],
                    'minitems' => 1,
                    'maxitems' => 1,
                ],
                'gif,png,svg'
            ),
        ],

The class \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig takes the following parameters:

public static function getFileFieldTCAConfig($fieldName, array $customSettingOverride = [], $allowedFileExtensions = '', $disallowedFileExtensions = '')

my translation so far:

          <!-- Icon File -->
          <settings.flexform.iconFile>
            <TCEforms>
              <displayCond>FIELD:settings.flexform.iconSet:!=:</displayCond>
              <label>LLL:EXT:av_vcard/Resources/Private/Language/Backend.xlf:plugin.avvcard.icon.file</label>
              <config>
                <type>select</type>
                <renderType>selectSingle</renderType>
                <itemsProcFunc>\TYPO3\CMS\Core\Utility\ExtensionManagementUtility->getFileFieldTCAConfig</itemsProcFunc>
                <itemsProcConfig>
                  <fieldName>settings.flexform.iconFile</fieldName>
                  <!-- here is something missing -->
                  <allowedFileExtensions>gif,png,svg</allowedFileExtensions>
                </itemsProcConfig>
              </config>
            </TCEforms>
          </settings.flexform.iconFile>

The second parameter to handover can be an empty array since these are (only) ovverride parameters. If left empty, nothing (bad) happens - this is my interpretation of the code.

I tried:

<customSettingOverride></customSettingOverride>

And I tried:

                  <customSettingOverride>
                    <type>inline</type>
                  </customSettingOverride>

But they all bring the error:

TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(): Argument #2 ($customSettingOverride) must be of type array, TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems given

Could someone help me find the error?

EDIT !!! for Thomas to explain!

I am currently on the way to develop my own extension (as starter). I have a BE plugin which shall create in the FE an icon and some text. Now I wanted to use the same BE elements in my BE flexform as B2K2 does for "texticon". But B2K2 does not have a Flexform - as far as I can see. BK2K uses a new tt_content element/type which then creates a DB record - as far as I understand the setup.

I don't want to create a DB record, just set the related information in a flexform of a STANDARD Plugin tt_content element.

My BE looks like this: enter image description here

As you can see, below "BE icon position" the same structure as in "texticon" of B2K2. Everything works fine. I can select the "BE icon background set" and I even can select the "BE icon background icon". All fine so far. This all is setup in the Flexform.

But! In B2K2 "texticon" after the selection of the IconSet, a list of all available icons below the select field for the icon is shown.

THIS IS THE MISSING PART in my Flexform.

Since B2K2 does not have a Flexform for this I had a look at the TCA definition and the presentation of the ICONS comes from the TCA Field "icon_file" as shown in the snippet.

Now I am trying to transform this TCA definition to a working Flexform definition.

O.K. - it's cosmetic. Since I could live with the select form but the BE user will not see how the icon looks like what he/she will select.

This is the view in B2K2 "texticon": enter image description here

averlon
  • 325
  • 3
  • 14
  • You can't use itemsProcFunc for this behaviour. It's two complete different things. Please don't mix it up. – Thomas Löffler Mar 22 '23 at 10:26
  • Is this a solution here? https://stackoverflow.com/questions/61383959/typo3-fal-in-flexform – Thomas Löffler Mar 22 '23 at 10:26
  • @ThomasLöffler the solution you referenced gets it closer, but still not the solution. I guess I have to dig a little bit deeper inte BK2K. I will see! – averlon Mar 22 '23 at 10:47
  • I don't get your problem. What do you want to achieve? – Thomas Löffler Mar 22 '23 at 16:35
  • @ThomasLöffler: please look at my update of the question. – averlon Mar 23 '23 at 15:39
  • In the EXT:bootstrap_package, the owner uses two different fields for it. See: https://github.com/benjaminkott/bootstrap_package/blob/master/Configuration/TCA/Overrides/100_pages.php#L51. The first selection is `nav_icon_set`, the appearing list is `nav_icon_identifier`. – Thomas Löffler Mar 31 '23 at 21:09

1 Answers1

0

The correct flexform is:

          <!-- Icon -->
          <settings.flexform.iconIcon>
            <TCEforms>
              <displayCond>FIELD:settings.flexform.iconSet:REQ:true</displayCond>
              <label>LLL:EXT:av_vcard/Resources/Private/Language/Backend.xlf:plugin.avvcard.icon.icon</label>
              <config>
                <type>select</type>
                <renderType>selectSingle</renderType>
                <itemsProcFunc>BK2K\BootstrapPackage\Service\IconService->getIconItems</itemsProcFunc>
                <itemsProcConfig>
                  <iconSetField>settings.flexform.iconSet</iconSetField>
                </itemsProcConfig>
                <fieldWizard>
                  <selectIcons>
                    <disabled>0</disabled>
                  </selectIcons>
                </fieldWizard>
              </config>
            </TCEforms>
          </settings.flexform.iconIcon>

My simple problem was a typo in "disabled"!!!!!

                    <disabled>0</disabled>
averlon
  • 325
  • 3
  • 14