Project

General

Profile

Actions

Bug #95814

closed

The itemsProcFunc configuration array has wrong pid from the 2nd content element on a page

Added by Andreas Kalkhoff about 3 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2021-10-29
Due date:
% Done:

0%

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

Description

I use an itemProcFunc to fill flexform items based on heritage-based data; filling an array of colors for editors to use which may differ based on the site they are editing.
This seems to be a regression considering issue #50551. Georg Ringer advised to use "$config['flexParentDatabaseRow']['pid']" as solution to that issue as the code base changed a lot since the creation of said issue.
$config['flexParentDatabaseRow']['pid'] however seems to have the same issue:
When I click "+ Content" after any element on a page "$config['flexParentDatabaseRow']['pid']" returns that prior element's uid as negative as pid. I do only get the proper pid on the topmost "+ Content" that's not affiliated to a content element.

E.g.:
On Page ID 345
(1) "+ Content"
(2) tt_content element uid 123 (any type, text or whatever)
(3) "+ Content"

=>

(1) $config['flexParentDatabaseRow']['pid'] returns "345"
(3) $config['flexParentDatabaseRow']['pid'] returns "-123"


Files

flexParentDatabaseRow.png (4.89 KB) flexParentDatabaseRow.png Andreas Kalkhoff, 2021-10-29 06:25

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #50551: The itemsProcFunc configuration array has wrong pid from the 2nd content element on a pageClosed2013-07-30

Actions
Actions #1

Updated by Andreas Kalkhoff about 3 years ago

  • Related to Bug #50551: The itemsProcFunc configuration array has wrong pid from the 2nd content element on a page added
Actions #2

Updated by Mike Street over 2 years ago

I am using v10.4.28 and can confirm this exists.

The code suggested from the related issue (https://forge.typo3.org/issues/50551#note-8) helped me resolve in this instance, but does seem unusual to have a property called `pid` return not the PID

$this->contentElementPid = $config['row']['pid'];

// if $config['row']['pid'] is < 0 then it points
// to the previous content element on the same page
if ($this->contentElementPid < 0) {
    $parentRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord(
            'tt_content',
            abs($this->contentElementPid),
            'pid'
    );

    $this->contentElementPid = $parentRec['pid'];
}
Actions #3

Updated by Georg Ringer 5 months ago

  • Status changed from New to Closed

even though this might look strange, this is desired, see e.g. https://docs.typo3.org/m/typo3/reference-coreapi/9.5/en-us/ApiOverview/Typo3CoreEngine/UsingDataHandler/Index.html

To insert a record after a given record, set the other record's negative uid as pid in the new record you're setting as data.

therefore closing the issue

Actions

Also available in: Atom PDF