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 #1

Updated by Dieter Porth about 4 years 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
Actions #2

Updated by Dieter Porth about 4 years 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
Actions #3

Updated by Simon Schaufelberger over 2 years ago

  • Description updated (diff)
Actions #4

Updated by Simon Schaufelberger over 2 years ago

  • Status changed from New to Accepted
  • Complexity set to easy
Actions #5

Updated by Simon Schaufelberger over 2 years ago

  • Category set to Backend API
Actions #6

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74441

Actions #7

Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74441

Actions #8

Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74441

Actions #9

Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74441

Actions #10

Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74441

Actions #11

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74462

Actions #12

Updated by Anonymous over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF