Project

General

Profile

Actions

Bug #92483

closed

TCA-column-flex-ds : The file definition with EXT: won't work

Added by Dieter Porth about 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2020-10-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

The following-column-example will produce the error `Data Structure ERROR: No [\'ROOT\'][\'el\'] element found in flex form definition.';`. because the file is not resolved.

        'tx_timer_timer' => [
            'exclude' => true,
            'label' => 'LLL:EXT:timer/Resources/Private/Language/locallang_db.xlf:tx_timer_general.field.tx_timer_timer',
            'config' => [
                'type' => 'flex',
                'ds_pointerField' => 'tx_timer_selector',
                'ds' => [
                    'default' => 'EXT:timer/Configuration/FlexForms/TimerDef/Default.xml',
                    'porthDaily' => 'EXT:timer/Configuration/FlexForms/TimerDef/DailyTimer.xml',
                    'porthYearly' => 'EXT:timer/Configuration/FlexForms/TimerDef/YearlyTimer.xml'
                ],
            ],
        ],

In the comment of `parseDataStructureByIdentifier` in TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools is written:

   * After the data structure definition is found, the method resolves:
     * * FILE:EXT: prefix of the data structure itself - the ds is in a file
     * * FILE:EXT: prefix for sheets - if single sheets are in files
     * * EXT: prefix for sheets - if single sheets are in files (slightly different b/w compat syntax)
     * * Create an sDEF sheet if the data structure has non, yet.

But the method fulfill it not.
Extend in the middle of the method the code, to fix the problem.
            // Resolve FILE: prefix pointing to a DS in a file
            if (strpos(trim($dataStructure), 'FILE:') === 0) {
                $file = GeneralUtility::getFileAbsFileName(substr(trim($dataStructure), 5));
                if (empty($file) || !@is_file($file)) {
                    throw new \RuntimeException(
                        'Data structure file ' . $file . ' could not be resolved to an existing file',
                        1478105826
                    );
                }
                $dataStructure = file_get_contents($file);
            // } beginn of additional code in Line 692
            } else if (strpos(trim($dataStructure), 'EXT:') === 0) {
                $file = GeneralUtility::getFileAbsFileName(substr(trim($dataStructure), 0));
                if (empty($file) || !@is_file($file)) {
                    throw new \RuntimeException(
                        'Data structure file ' . $file . ' could not be resolved to an existing file',
                        1478105826
                    );
                }
                $dataStructure = file_get_contents($file);
            } // End of additional code
Actions

Also available in: Atom PDF