CodersCare / gridelements

Be part of the future of TYPO3! Support Gridelements now and unlock exclusive early access to v13! The well-established Gridelements V12 elevates TYPO3 by bringing grid-based layouts to content elements, with powerful features like advanced drag & drop and real references. Supercharge your workflow and make daily tasks easier. Sponsor us here:
https://coders.care/for/crowdfunding/gridelements
GNU General Public License v3.0
5 stars 25 forks source link

[BUGFIX + PATCH] Fix determination of flexform-data #43

Open soda-2005 opened 1 year ago

soda-2005 commented 1 year ago

Without the patch "0001-BUGFIX-fix-determination-of-flexform-data.patch", the flexform-data can't be determinated, if we copy an gridelement (which contains a flexform) in TYPO3v11. The patch 0001-BUGFIX-fix-determination-of-flexform-data.patch is a no-brainer - so, please use it :-)

How to reproduce the bug in TYPO3v11?

  1. Create an gridelement-record (on any TYPO3-page), which contains a flexform.
  2. Copy that gridelement-record Outcome: The copied gridelement-record has no data in his flexform. If the flexform contains images (wich are located in sys_file_reference-DB-table), than those images are now doubled in the original gridelement-record
Bunnyfield commented 1 year ago

Thanks for the report, but after looking at the patch I don't think this has something to do with the CMS 11 problems you described.

The part that gets changed by the patch will only be executed in CMS versions below 11 anway, so the patch should not change this at all. If this fixes your problems in CMS 11 this would be really weird, so the question is, if there was more than just that change in your patched TYPO3 project.

soda-2005 commented 1 year ago

Hi Bunnyfield, Without this patch, the "complete logic to determine the flexform-config" will not be called/processed (so, as the result, the 'dummy' flexform-config 'FILE:EXT:gridelements/Configuration/FlexForms/default_flexform_configuration.xml' is used), because when you copy an gridelement, than the variable $row does NOT contain the uid - so $row['uid'] is NOT set.

The only thing, which this patch does is: It does NOT check, if $row['uid'] exists - because $row['uid'] is NOT used inside the hook (in TYPO3v11).

soda-2005 commented 1 year ago

OK, sorry - i must change my statement:

  1. YES - the flexform-data will be copied (also, when the patch is NOT applied/used) - you have right at this point.
  2. When the patch is NOT applied/used, than images (which are defined in flexform via inline-formelement) will NOT correctly copied to the new/copied gridelement. The image will be 'stored/put' at the original gridelement (so the original gridelement will get 2 images instead of one - it will be doubled).

I used this flexform-config (to select an image inside an gridelement).

Bunnyfield commented 1 year ago

My bad - the patch looked as if it was only concerning the part containing "fixVersioningPid", while it did not show the rest of the method.

Still the question is, why there is no 'uid' in CMS 11 in the first place, because usually there is either an integer or a placeholder starting with 'NEW' and AFAIK this did not change with CMS 11.

So maybe the problem is actually connected to that missing uid value and that again might be the reason for several FlexForm related problems that came up with CMS > 10

soda-2005 commented 1 year ago

Still the question is, why there is no 'uid' in CMS 11 in the first place That's true - but: who cares? In TYPO3v11 we don't need the UID in the hook - so, we should not check, if the UID exists, when we don't use it ;-)

Bunnyfield commented 1 year ago

So the solution would be to just move it to the second if clause, which is a bit less complicated than introducing another method.