Project

General

Profile

Actions

Bug #94488

closed

pid not configurable in addRecord TCA

Added by Martin no-lastname-given almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2021-07-06
Due date:
% Done:

0%

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

Description

TCA/select/selectMultipleSideBySide/addRecord::render() delivers always pid = default=currentPid, so '###SITEROOT###' or 'pid'=>'xx' does not work.
TCA Documentation: https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/selectMultipleSideBySide.html#fieldcontrol

See typo3/sysext/backend/Classes/Form/FieldControl/AddRecord.php:39
Is:

$options = $this->data['renderData']['fieldControlOptions'];

Should be

$options = $this->data['renderData']['fieldControl']['addRecord'];

Array 'fieldControlOptions' seems never be populated and correct config info is in '['fieldControl'][addRecord]'. Maybe bug is elsewhere (who does fill ['fieldControlOptions']?) but patching this worked for me.
Use Case: this has to work as documented:

...
  'someField' => [
            'exclude' => true,
            'label' => $ll.'.someField',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'size' => 3,
                'minitems' => 1,
                'fieldControl' => [
                    'addRecord' => [
                        'disabled' => false,
                        'title' => 'addRecordTest for Test',
                        'setValue' => 'set',
                        'pid' => '###SITEROOT###',  // this does not work as documented!!!
                    ],
                    'editPopup' => [
                        'disabled' => false,
                    ],
                ],
                'foreign_table' => 'someTable',
                'foreign_table_where' =>
                    'AND {#someTable}.{#pid} IN(###SITEROOT###) '
            ],
        ],
...

If we touch addRecord class anyway, we could enable the marker ###PAGE_TSCONFIG_ID### by something like this:

if (isset($parameterArray['fieldTSConfig']['PAGE_TSCONFIG_ID']))
{
  $pid = $parameterArray['fieldTSConfig']['PAGE_TSCONFIG_ID'];
}

Same for Typo3 v9

Actions

Also available in: Atom PDF