Review main Abandoned

66814[FEATURE] Allow rendering FlexForm fields anywhere in FormEngine

Claus Due CR 0 V 0 Normal +172 −7 updated 06/16/21, 20:49

Commit message

Allows rendering a field defined in a FlexForm DS as if
it were any standard type of TCA field, by referencing
the desired field as "$flexFormFieldName.$sheetName.$fieldName",
e.g. "pi_flexform.sDEF.myField".

The field can then be used in "showitem" and "palette" settings in
TCA.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 5

Review log 1924

  1. Claus Due uploaded patch set 1 11/22/20, 13:36

  2. Claus Due updated the commit message in patch set 2 11/22/20, 13:37

  3. TYPO3com voted on patch set 1 V -1 11/22/20, 13:37 Completed build in 20s on Sun, 22 Nov, 01:37 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7505

  4. TYPO3com voted on patch set 2 V -1 11/22/20, 13:37 Completed build in 18s on Sun, 22 Nov, 01:37 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7506

  5. Claus Due wrote 11/22/20, 13:37

    Topic set to FormEngine
  6. Claus Due uploaded patch set 3 11/22/20, 13:40

  7. TYPO3com voted on patch set 3 V +1 11/22/20, 13:51 Completed build in 10m 34s on Sun, 22 Nov, 01:51 PM Test Summary: 32391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7507

  8. Georg Ringer commented on patch set 3 11/22/20, 18:39

    please add a rst for the feature!
  9. Jonas Eberle commented on patch set 3 V +1 11/23/20, 18:10

    I am taking care of the .rst. Apart from "section", I was able to move all field types (even "inline").

    SingleFieldContainer.php:91

    When trying to move a "section" out of a FlexForm, I get an exception here. For now I'll exclude "section" from the feature .rst but maybe we can do something about it? Uncaught TYPO3 Exception: #1431452406 : Missing "renderType" in TCA of field "[tx_styleguide_flex][section_1]". | TYPO3\CMS\Backend\Form\Exception thrown in file /var/www/html/typo3/sysext/backend/Classes/Form/NodeFactory.php in line 147. #0 /var/www/html/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php(91): TYPO3\\CMS\\Backend\\Form\\NodeFactory->create(Array)\n #1 /var/www/html/typo3/sysext/backend/Classes/Form/Container/PaletteAndSingleContainer.php(146): TYPO3\\CMS\\Backend\\Form\\Container\\SingleFieldContainer->render()\n #2 /var/www/html/typo3/sysext/backend/Classes/Form/Container/TabsContainer.php(87): TYPO3\\CMS\\Backend\\Form\\Container\\PaletteAndSingleContainer->render()\n #3 /var/www/html/typo3/sysext/backend/Classes/Form/Container/FullRecordContainer.php(84): TYPO3\\CMS\\Backend\\Form\\Container\\TabsContainer->render()\n #4 /var/www/html/typo3/sysext/backend/Classes/Form/Container/OuterWrapContainer.php(56): TYPO3\\CMS\\Backend\\Form\\Container\\FullRecordContainer->render()\n
  10. Jonas Eberle commented on patch set 3 11/23/20, 19:53

    When moving type=select that is used in a displayCond in another field (example: https://github.com/TYPO3/styleguide/blob/master/Configuration/TCA/tx_styleguide_flex.php#L355), I am getting a warning > PHP Warning: implode(): Invalid arguments passed in /var/www/html/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php line 264 > in /var/www/html/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php line 264 The 2nd parameter is null in that case: > implode('', $parameterArray['fieldChangeFunc']),
  11. Jonas Eberle uploaded patch set 4 11/23/20, 20:16

  12. Jonas Eberle voted on patch set 4 V +1 11/23/20, 20:21

  13. Jonas Eberle commented on patch set 4 11/23/20, 20:23

    I added the current limitations to the feature .rst. If you see a possibility to remove these limitations, it would be even better of course ;) But already like that I think it has great value.
  14. TYPO3com voted on patch set 4 V +1 11/23/20, 20:28 Completed build in 11m 51s on Mon, 23 Nov, 08:28 PM Test Summary: 32391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7529

  15. Jonas Eberle commented on patch set 4 11/24/20, 08:57

    SingleFieldContainer.php:91 Reply

    section won't be possible since there is no TCA equivalent.
  16. Jonas Eberle uploaded patch set 5 11/25/20, 08:51

  17. Jonas Eberle commented on patch set 5 V +1 11/25/20, 08:58

    I tested the displayCond limitation and amended the .rst accordingly. A `displayCond` in moved fields (either referencing fields inside the current Flexform or in the record via `parentRec`) will produce exceptions. So does a `displayCond` somewhere referencing a moved field.
  18. TYPO3com voted on patch set 5 V +1 11/25/20, 09:03 Completed build in 11m 14s on Wed, 25 Nov, 09:03 AM Test Summary: 32391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7565

  19. Christian Kuhn commented on patch set 5 CR -1 11/25/20, 11:35

    I'm not sure if this is a good idea. The main reasoning from the issue is: "This would remedy a disadvantage of FlexForms (limited backend interface possiblities) while keeping its advantage (a "simple" structured value store within only 1 database column)." I disagree here: The anonymous flexform structure is a disadvantage, not an advantage. It leads to tons of issues with references, it is hard to migrate, searching is impossible without parsing the data and more. Allowing to pull fields out of flex form context and make them look like casual fields embraces the issues with these anonymous structures even more. There is no point in defining flex form structures for fields that are later shown as top level fields: Simply use a db column instead. They are not evil. The example in the issue for a 'template selection' of a plugin should be a db column. Imho, flex forms are good for two things: Encapsulating lots of simple and flat plugin settings - stuff like 'how many items per page' and so on. And if those are just a couple, it'd use db columns for them, too. If a 'template selection' should be rendered at a different place, it should be pulled out of the flex form and made a column. Second place is if you really get an advantage from the anonymous structures - if you use repeatable sections. And even in this case, it's often worth a question on why this structure hasn't been modeled on db level directly. Looking at the patch, the integration is already not fully transparent: display conditions don't work, which is actually quite a drawback. I have the feeling we'll find more issues like that if digging deeper. As a result, I think we shouldn't integrate that feature. If anyone *really* needs this, I'd suggest to do that within an extension for now: All containers touched by the patch can be overriden by extensions using the formEngine nodeFactory. Maybe this feature could live in an extension for the time being to see if it finds broader acceptance and use. If it turns out to be a feature everyone needs and wants, we could then still re-discuss the impact. Does that sound ok?
  20. Claus Due commented on patch set 5 11/25/20, 12:43

    > Patch Set 5: Code-Review-1 > > Allowing to pull fields out of flex form context and make them look like casual fields embraces the issues with these anonymous structures even more. We should look at this from a UX perspective. While I don't disagree that there are issues with FlexForms, the point of this patch is to make a better UX possble by relocating these fields, so they are not necessarily grouped with in a single "block" in the UI. One major reason is to be able to logically group fields that, for example, deal with display controls, along with other display related fields. > There is no point in defining flex form structures for fields that are later shown as top level fields: Simply use a db column instead. They are not evil. The example in the issue for a 'template selection' of a plugin should be a db column. There is a point - FlexForm structures can be dynamic, root-level columns in tables cannot (at least not without various hooks to manipulate the schema on-the-fly, which seems like a worse idea to me). A secondary point is that defining every possible field as root-level table column runs the very real risk of ending up with hundreds of columns per table. > Looking at the patch, the integration is already not fully transparent: display conditions don't work, which is actually quite a drawback. I have the feeling we'll find more issues like that if digging deeper. Display conditions will be handles by an upcoming patch set. It's possible there may be other issues if you keep digging, but in that case I would prefer that these got addressed instead of dismissal based on something that is theoretical; a hunch. It is also worth noting here that the patch doesn't change a single thing about how "normal" fields work so we don't risk adversely affecting these "normal" fields. The impact is limited not only to FlexForm fields, but FlexForm fields which somebody relocates by manipulating the showitems schema. > As a result, I think we shouldn't integrate that feature. If anyone *really* needs this, I'd suggest to do that within an extension for now: All containers touched by the patch can be overriden by extensions using the formEngine nodeFactory. Maybe this feature could live in an extension for the time being to see if it finds broader acceptance and use. If it turns out to be a feature everyone needs and wants, we could then still re-discuss the impact. Does that sound ok? Unfortunately that isn't up to me to decide. The feature was requested from the structured content initiative as a UX improvement and I don't know their attitude towards making this an extension (which does only this one little thing but would necessarily need to override a lot of code to achieve the goal, with all the risk that large overrides come with). But the main point is that I think we should look at this from a broader UX perspective, rather than considering it as something that encourages FlexForm usage, look at it as something that makes FlexForms less bad UX. Additionally, look at it as something that makes it possible to create better UX even for third-party extensions that have chosen to deliver their fields as FlexForms - in which case recreating those fields as native table fields may not be possible at all without recreating the entire extension.
  21. Jonas Eberle commented on patch set 5 01/09/21, 12:54

    Christian, I think your opposition is too evangelistic here. FlexForms are a difficult beast data-wise yet they are very widely adopted. I would guess every second TER-extension uses them, mostly in plugin records. In that form they were and are part of learning material for developers. The Structured Content Initiative has opted for a blob storage for simple content blocks, using FlexForms now yet still leaving the door open for using JSON blobs or similar (under FormEngine, too). We explored tt_content fields, separate full or key-value tables on the way. I am supporting that decision although it is not my favorite. I think using an extension in a part that is as volatile as FormEngine will not meet the goals. In that case I think we would rather not have it at all. I think we should come back to discuss the actual patch. And I hope we can find a fix for the displayCond problem, of course.
  22. Jonas Eberle commented on patch set 5 06/09/21, 20:01

    Ok, shall we abandon this?
  23. Christian Kuhn commented on patch set 5 06/11/21, 19:35

    Reply

    Probably, yes: I don't think this approach will find broader acceptance in the core team with current state of both the patch and core flex form handling. I'd expect to find a lot of additional and hard to solve issues when it comes to language and workspace handling, and I have the feeling we're not doing ourselves a favor if we decide to add this. I'd say we could keep the patch in gerrit for another week or so to see if further points pop up, and abandon if this is not the case.
  24. Christian Kuhn abandoned the change 06/16/21, 20:49