[TASK] Adds fileReferenceUid to content rendering 59/21759/3
authorLars Peipmann <lars@peipmann.de>
Mon, 1 Jul 2013 09:28:43 +0000 (11:28 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 27 Jul 2013 16:07:31 +0000 (18:07 +0200)
FrontendContentAdapterService saves the file uid but not the
file reference uid.

This commits adds the file reference uid.

Change-Id: I5af09521d5dadc194ec567aec24792def370aedc
Resolves: #49535
Releases: 6.2
Reviewed-on: https://review.typo3.org/21759
Reviewed-by: Andreas Wolf
Reviewed-by: Lars Peipmann
Reviewed-by: Steffen Ritter
Reviewed-by: Stefan Neufeind
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Resource/Service/FrontendContentAdapterService.php

index b152070..1e4910e 100644 (file)
@@ -96,9 +96,11 @@ class FrontendContentAdapterService {
                                                'captions' => array(),
                                                'links' => array(),
                                                'alternativeTexts' => array(),
-                                               $migrateFieldName . '_fileUids' => array()
+                                               $migrateFieldName . '_fileUids' => array(),
+                                               $migrateFieldName . '_fileReferenceUids' => array(),
                                        );
                                        $oldFieldNames[$migrateFieldName . '_fileUids'] = $migrateFieldName . '_fileUids';
+                                       $oldFieldNames[$migrateFieldName . '_fileReferenceUids'] = $migrateFieldName . '_fileReferenceUids';
 
                                        foreach ($files as $file) {
                                                /** @var $file \TYPO3\CMS\Core\Resource\FileReference */
@@ -109,13 +111,14 @@ class FrontendContentAdapterService {
                                                $fileFieldContents['links'][] = $fileProperties['link'];
                                                $fileFieldContents['alternativeTexts'][] = $fileProperties['alternative'];
                                                $fileFieldContents[$migrateFieldName .  '_fileUids'][] = $file->getOriginalFile()->getUid();
+                                               $fileFieldContents[$migrateFieldName .  '_fileReferenceUids'][] = $file->getUid();
                                        }
                                        foreach ($oldFieldNames as $oldFieldType => $oldFieldName) {
                                                if ($oldFieldType === '__typeMatch') {
                                                        continue;
                                                }
-                                               // For paths, make comma separated list
-                                               if ($oldFieldType === 'paths' || substr($oldFieldType, -9) == '_fileUids') {
+                                               if ($oldFieldType === 'paths' || substr($oldFieldType, -9) == '_fileUids' || substr($oldFieldType, -18) == '_fileReferenceUids') {
+                                                       // For paths and uids, make comma separated list
                                                        $fieldContents = implode(',', $fileFieldContents[$oldFieldType]);
                                                } else {
                                                        // For all other fields, separate by newline