#67259addToAllTCAtypes does not work with replace position
Description
I am using addToAllTCAtypes to extend an field with a Palette like this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'tx_myext_entities',
'header;;pl_header;;',
'',
'replace:header'
);
The types of the tx_myext_entities table looks like this:
return array(
'ctrl' => array(
'title' => 'tx_myext_entities',
),
'interface' => array(
'showRecordFieldList' => 'header'
),
'columns' => array(
'header' => array (
'exclude' => 1,
'label' => 'Header',
'config' => array (
'type' => 'input',
'size' => '255',
)
)
),
'types' => array(
'0' => array('showitem' => 'header')
),
'palettes' => array (
'1' => array('showitem' => ''),
)
);
With TYPO3 6.2.11 and before i get the folowing result after the addToAllTCAtypes call:
return array(
'ctrl' => array(
'title' => 'tx_myext_entities',
),
'interface' => array(
'showRecordFieldList' => 'header'
),
'columns' => array(
'header' => array (
'exclude' => 1,
'label' => 'Header',
'config' => array (
'type' => 'input',
'size' => '255',
)
)
),
'types' => array(
'0' => array('showitem' => 'header;;pl_header;;')
),
'palettes' => array (
'1' => array('showitem' => ''),
)
);
That is what I want!
Since TYPO3 6.2.12 the header field was not replaced anymore.
The remaining calls to add the palette and te new columns i have omitted the sake of clarity.
I have found out, that the removeDuplicatesForInsertion method is the cause. This Method removes all duplicates, but ignores the insert position “replace”, so a replace of an field is not possible.
This error exists since the fix in #65480 wit the following commit:
[BUGFIX] Compare field names without configuration With patch https://review.typo3.org/34019/ the function ExtensionManagementUtility::removeDuplicatesForInsertion was rewritten. But the rewrite fails for fields with additional configuration and returns wrong field information. Resolves: #65480 Releases: master, 6.2 Change-Id: I9aa35cd7ef5142e7b57489bf6e19a78811b8c335 Reviewed-on: http://review.typo3.org/38528 Reviewed-by: Markus Klein <klein.t3@reelworx.at> Tested-by: Markus Klein <klein.t3@reelworx.at> Reviewed-by: Xavier Perseguers <xavier@typo3.org> Tested-by: Xavier Perseguers <xavier@typo3.org> Reviewed-on: http://review.typo3.org/38610