Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Render Images from FlexForm Field within Collection in TYPO3 Frontend #292

Open
tgrigoryan234 opened this issue Nov 14, 2024 · 8 comments
Labels

Comments

@tgrigoryan234
Copy link

tgrigoryan234 commented Nov 14, 2024

I have an image field within a FlexForm field, but in the frontend, only the count of images is loaded, not the actual images. To address this, I need to write a custom Processor. This becomes more complex when the FlexForm field is part of a collection within a content element.
Example Content Element config.yaml
....
fields:

identifier: teasers
type: Collection
minitems: 1
table: tx_teasers
labelField: title
appearance:
  collapseAll: true
  levelLinksPosition: bottom
fields:
  - identifier: teaser
    type: FlexForm
    label: Teaser Settings

The FlexForm (teaser) inside this collection includes an image field. How can I retrieve and display the actual image in the frontend?
There are currently no hooks or signals or options in the Data Decoration process that allow adding a field to Content Block data. In the past, this was possible using the offsetSet function. I don’t understand why it was removed.

@nhovratov
Copy link
Contributor

Which version are you on? TYPO3 v13 / v1 or TYPO3 v12 / 0.x?

@nhovratov
Copy link
Contributor

In v13 FlexForm relations should be resolved as well. Could you please show me your complete yaml snippet of the FlexForm field?

@nhovratov
Copy link
Contributor

Just tested it with this configuration and it works:

name: example/card-group
fields:
  - identifier: header
    useExistingField: true
  - identifier: settings
    type: FlexForm
    fields:
      - identifier: image
        type: File

Screenshot 2024-11-14 at 10-10-21 Home

@nhovratov
Copy link
Contributor

OK, your are RIGHT. When putting the FlexForm inside a Collection it does indeed not work.

@nhovratov
Copy link
Contributor

nhovratov commented Nov 14, 2024

We will work on a bugfix in Core. Just one question: Why does the File field has to be inside FlexForm? Couldn't you just place it inside the Collection table?

There are currently no hooks or signals or options in the Data Decoration process that allow adding a field to Content Block data. In the past, this was possible using the offsetSet function. I don’t understand why it was removed.

There is! But it's not documented yet. See: #278

The offset function was removed in favor of this Event. This Event has more flexibility and it's easier to work with when having nested Collections like in your case.

@tgrigoryan234
Copy link
Author

I wanted to create a FlexForm structure, for example, for a teaser with the same fields that could be used both as a standalone element and within a slider or accordion. To achieve this, I created a teaser FlexForm in tt_content and reused it across various content blocks.

@nhovratov
Copy link
Contributor

nhovratov commented Nov 14, 2024

Created a forge issue: https://forge.typo3.org/issues/105597

@tgrigoryan234
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants