[BUGFIX] TCA: Make ###CURRENT_PID### work in foreign_table_where in IRRE 34/50934/5
authorNicole Cordes <typo3@cordes.co>
Mon, 12 Dec 2016 16:53:10 +0000 (17:53 +0100)
committerNicole Cordes <typo3@cordes.co>
Sun, 26 Feb 2017 20:19:34 +0000 (21:19 +0100)
The patch adds the current database row to the data passed to the select
field rendered by foreign_selector of IRRE.
This data is necessary to properly resolve the ###CURRENT_PID### marker
in a foreign_table_where clause.

Resolves: #78960
Releases: master, 7.6
Change-Id: I17f6b4a78d20c101ef7caab227d23c87f138e8ce
Reviewed-on: https://review.typo3.org/50934
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Jasmina LieƟmann <code@frauliessmann.de>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php

index 302429c..0d81e9b 100644 (file)
@@ -1048,11 +1048,14 @@ abstract class AbstractItemProvider
                 }
                 $foreignTableClause = implode('', $whereClauseParts);
             }
-            // Use pid from parent page clause if in flex flom context
-            if (strpos($foreignTableClause, '###CURRENT_PID###') !== false
-                && !empty($result['flexParentDatabaseRow']['pid'])
-            ) {
-                $effectivePid = $result['flexParentDatabaseRow']['pid'];
+            if (strpos($foreignTableClause, '###CURRENT_PID###') !== false) {
+                // Use pid from parent page clause if in flex form context
+                if (!empty($result['flexParentDatabaseRow']['pid'])) {
+                    $effectivePid = $result['flexParentDatabaseRow']['pid'];
+                // Use pid from database row if in inline context
+                } elseif (!$effectivePid && !empty($result['databaseRow']['pid'])) {
+                    $effectivePid = $result['databaseRow']['pid'];
+                }
             }
 
             $siteRootUid = 0;
index 34d6c98..840393a 100644 (file)
@@ -255,6 +255,7 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
                 // do extra handling of pageTsConfig merged here. Just provide "parent" pageTS as is
                 'pageTsConfig' => $result['pageTsConfig'],
                 'userTsConfig' => $result['userTsConfig'],
+                'databaseRow' => $result['databaseRow'],
                 'processedTca' => [
                     'ctrl' => [],
                     'columns' => [