Timeline for How to render a field collection?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 22, 2014 at 20:12 | comment | added | marcvangend |
Sorry it isn't working for you. I would need a full installation and a debugger to understand what's going on. In any case, be aware that dpm() does have some limitations. While it can show public properties of objects, I don't think it will list view() (which is a method not a property). This documentation says that the FieldCollectionItemEntity should have a view() method since it extends the Entity class.
|
|
Aug 22, 2014 at 15:06 | comment | added | Kojo |
Not really, sorry : as you can see in dpm($fieldcollection) , there's no view property in FieldCollectionItemEntity object. So $field_collection->view('full') or similar fails. I already went several times to related manage display page and tried all possibilities :(( At the moment I ended chaining #markup of each field_view_field child array, which is a horrible solution
|
|
Aug 22, 2014 at 14:51 | comment | added | marcvangend | I think it better to not go into the field collection and take specific field out of it, but rather navigate to /admin/structure/field-collections and click the 'manage display' link for your field collection. That page should allow you to configure the visibility, formatter and order of the fields in your field collection. Does that answer your question? | |
Aug 22, 2014 at 14:02 | comment | added | Kojo |
Of course you can't do the job for me ;) I edited the question with my progress. field_collection_field_get_entity is a kind of shortcut that gives me the full FieldCollectionItemEntity, but I still feel stupid on how to render all children fields
|
|
Aug 22, 2014 at 13:15 | comment | added | marcvangend |
OK, I don't know what the rest of your code does so that's hard to debug for me. You could try return drupal_render($field_collection->view('full')); instead. Also, make sure the full view mode of the field collection is configured correctly.
|
|
Aug 22, 2014 at 13:12 | comment | added | Kojo |
Thanks for you answer ! Out of the box, your snippet returns field_collection_item: ? Not sure I understand how you suggest to use it.
|
|
Aug 22, 2014 at 12:51 | history | answered | marcvangend | CC BY-SA 3.0 |