Active
Project:
Field collection
Version:
7.x-1.0-beta3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2012 at 10:45 UTC
Updated:
29 Jan 2018 at 11:40 UTC
Jump to comment: Most recent
Comments
Comment #1
Nehbur commentedI think what you need is
Thanks for your ticket, that helped me a lot, hope this helps you!
Comment #2
Nehbur commentedI've found the problem why the field collection is not present in the $content / $node var in the node template. Annoying as hell, but it has to do with "display fields" in the content type. If you don't take care of that tab it's very easy to miss, but in my situation the field was not displayed. Once I've made it display, you can access the vars (field collection) as an array.
Comment #3
wadmiraal commentedThis is not very themer-friendly, plus it adds logic to the templates, which isn't recommended.
Wouldn't it be possible to add
$field_*variables to the node.tpl.php automatically, like CCK did ? That would be far more logical. The data is linked (so to speek) to the node anyway.I'm not very familiar with the Entity API, but I could have a look at it if necessary.
Thanks for the module btw. Bummer this didn't made it to Drupal core. It's such a cool feature :-).
Comment #3.0
wadmiraal commentedtypo
Comment #4
jmuzz commentedA better solution than putting the logic in the template may be to use hook_entity_view or to create a custom field in display suite.
I don't think field collections should add all of the nested field collection data to a host entity by default. It's not necessary to render the host since to it the field collection is just a field to be rendered with its own functions. It might make sense to provide a function that would expand the field collections in an entity.
Comment #5
omrmankar