Feature #79350
closedMake "RECORDS" know more about it's contents
0%
Description
As far as I can see, the INSERT RECORDS content element renders each record individually.
So a rendered record has no knowledge if there are others in the same CE. And there is no master container for the CE that knows about it's children. Correct?
(I use "insert records" to display contacts from a custom extbase extension on a page, and I'd like to get a different title and layout if there are one or several items.)
Would it be possible to make that CE more "gnostic" of its contents?
- Maybe pass along that information (how many records are being rendered) with a wrapper to the entire CE?
- Or in addition to rendering each record individually, return the data in an array that has the rendered content as well as the raw data?
I'm not sure if there are implications that prohibit this, so I thought I'd ask.
Cheers
Urs
PS This preceded the ticket
http://stackoverflow.com/questions/41598570/typo3-insert-records-element-detect-number-of-items/
Probably referring to those
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
http://api.typo3.org/typo3cms/7/html/_records_content_object_8php_source.html
Updated by Georg Ringer almost 8 years ago
- Target version changed from 8 LTS to 9 LTS
IMO the best approach would be to use a custom dataprocessor/viewhelper which gets you the information you need. I am not sure if this feature should make it into the core, therefore I leave the issue open.
Updated by Mona Muzaffar over 7 years ago
- Status changed from New to Needs Feedback
@Urs Bream do you think this feature should still make it into the core or is it solved by using a custom viewhelper?
Updated by Urs Braem over 7 years ago
@Mona As in so many cases, I haven't gone further. So on a personal level, I can't really say yes.
On a conceptual level, I think so, yes. But that's up to the core team
Updated by Mona Muzaffar over 7 years ago
- Status changed from Needs Feedback to New
Updated by Susanne Moog about 7 years ago
- Category changed from Content Rendering to Frontend
Updated by Susanne Moog about 6 years ago
- Target version changed from 9 LTS to Candidate for Major Version
Updated by Susanne Moog about 2 years ago
- Status changed from New to Closed
As far as I can see, this is actually already possible.
When rendering insert records elements, the cObj has a key "parentRecord" which contains the database row of the insertRecord element. That in turn contains (in source) the list of elements to be rendered, therefor we know both how many and which elements are rendered.
If there is anything still missing, please let us know.