Bug #92483

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

Added by Dieter Porth 22 days ago. Updated 22 days ago.

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

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
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 fullfill it not.
Extend in methe middl 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

History

#1 Updated by Dieter Porth 22 days ago

  • Subject changed from TCA. flex- to TCA-column-flex-ds The file definieion EXT: won't work

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 fullfill it not.
Extend in middle of the method `TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools->parseDataStructureByIdentifier`(line 692ff) 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

#2 Updated by Dieter Porth 22 days ago

  • Subject changed from TCA-column-flex-ds The file definieion EXT: won't work to TCA-column-flex-ds : The file definition with EXT: won't work

Also available in: Atom PDF