Project

General

Profile

Actions

Bug #57824

closed

Palette fields are not wrapped, because --linebreak-- values are removed

Added by Hendrik Becker over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extension Manager
Target version:
Start date:
2014-04-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

A statement like this in ext_tables.php:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('pages', 'myPalette', 'tx_myext_myfield1, --linebreak--, tx_myext_myfield2, --linebreak--, tx_myext_myfield2, --linebreak--, tx_myext_myfield3');

is not interpreted correctly. The method \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeDuplicatesForInsertion() removes all duplicated fields, including the "--linebreak--"s on line 643:

$insertionList = implode(', ', array_unique($insertionListParts));

Only the first "--linebreak--" is kept.


Files

patch-1.patch (1.78 KB) patch-1.patch Christian Ludwig, 2014-11-10 22:59
patch-2.patch (1.75 KB) patch-2.patch Christian Ludwig, 2014-11-10 23:02

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #65480: TYPO3 6.2.10 Flexform: Values of section elements are not displayedClosedNicole Cordes2015-03-03

Actions
Actions #1

Updated by Christian Ludwig about 10 years ago

  • Target version set to next-patchlevel

A fixed method could look like this.

    static protected function removeDuplicatesForInsertion($insertionList, $list = '') {
        $insertionListParts = preg_split('/\\s*,\\s*/', $insertionList);
        $cleanInsertionListParts = array();
        foreach ($insertionListParts as $fieldName) {
            if ($fieldName == '--linebreak--' || !in_array($fieldName, $cleanInsertionListParts)) {
                $cleanInsertionListParts[] = $fieldName;
            }
        }
        $cleanInsertionList = implode(', ', $cleanInsertionListParts);
        if ($list === '') {
            return $cleanInsertionList;
        }
        // Get a list of fieldNames that are present in the list.
        preg_match_all('/(?:^|,)\\s*\\b([^;,]+)\\b[^,]*/', $list, $listMatches);
        // Remove the field names from the insertionlist.
        $fieldReplacePatterns = array();
        foreach ($listMatches[1] as $fieldName) {
            if ($fieldName != '--linebreak--') {
                $fieldReplacePatterns[] = '/(?:^|,)\\s*\\b' . preg_quote($fieldName, '/') . '\\b[^,$]*/';
            }
        }
        return preg_replace($fieldReplacePatterns, '', $cleanInsertionList);
    }

Anyway I think this method is incomplete because it does not check for duplicate fields respecting all palettes and normal fields. So imho its call could be removed from addFieldsToPalette() and executePositionedStringInsertion() what would fix the problem too.

Actions #3

Updated by Christian Ludwig about 10 years ago

Sorry, swaped direction in patch-1.patch.
Please use patch-2.patch!

Actions #4

Updated by Gerrit Code Review about 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019

Actions #5

Updated by Christian Ludwig about 10 years ago

Please review the patch http://review.typo3.org/34019 (it is refactored compared to the ones posted here) so it can be part of the next minor release of v6.2.
Infos about how to review can be found here http://wiki.typo3.org/Contribute_Walkthrough

Actions #6

Updated by Gerrit Code Review about 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019

Actions #7

Updated by Gerrit Code Review about 10 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019

Actions #8

Updated by Gerrit Code Review about 10 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019

Actions #9

Updated by Gerrit Code Review about 10 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/34019

Actions #10

Updated by Gerrit Code Review almost 10 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35745

Actions #11

Updated by Wouter Wolters almost 10 years ago

  • Description updated (diff)
  • Status changed from Under Review to Resolved
Actions #12

Updated by Kai Möller over 9 years ago

The commit breaks flexform configuration as described in Bug #65480

Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF