Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I want to display a fieldgroup from a node (of type Vendor) referenced from another node (of type Product) outside its template (i.e. inside the template of Product, not Vendor). I want to know how to force the [#children] to be created.
I've recently learnt how to force the creation of the ['view'] for content:
//http://drupalcontrib.org/api/function/content_fields/6
$field = content_fields($field_name,$content_type_name);
//http://drupalcontrib.org/api/function/content_view_field/6
$output = content_view_field($field,$node);
I'm looking for an equivalent for a fieldgroup.
grateful for feedback,
Webel
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedIf you know how to use content_view_field(), then you know how to use fieldgroup_view_group().
a) Get the latest development snapshot of CCK for Drupal 6.
b) Open cck/modules/fieldgroup/fieldgroup.module and look for functions:
--- fieldgroup_build_content(): Build the node content element needed to render a fieldgroup.
--- fieldgroup_view_group(): Render a single field group, fully themed with label.
An example that uses fieldgroup_view_group() can be found in cck/modules/fieldgroup/panels/content_types/content_fieldgroup.inc, function fieldgroup_content_fieldgroup_content_type_render().
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedBetter title...
Comment #3
webel CreditAttribution: webel commented@markus_petrux Thanks for detailed feedback, I'll try it and report back here. BTW I did look for such under http://drupalcontrib.org/api/file/contributions/cck/modules/fieldgroup/f... but those methods aren't listed there.
Comment #4
webel CreditAttribution: webel commentedOk, this worked for me after installing cck-6.x-2.x-dev, many thanks, Webel
Comment #5
yched CreditAttribution: yched commentedJust a note for markus: would it be possible to commit the new fieldgroup_view_group() to HEAD ?
Don't bother making it actually *work*, fieldgroup.module is by far not fully ported to D7 and I'd be utterly surprised if it produced anything else than a bunch of fatal errors right now. It's just so that we don't lose track of D6 evolutions.
Thanks !
Comment #6
markus_petrux CreditAttribution: markus_petrux commented@yched: Sure, the patches were here: #495582: Panels integration for multigroups
I'll checkout HEAD, apply the relevant changes there, and update that issue. I won't be able to test it against D7 though. Just the commit.
Comment #7
yched CreditAttribution: yched commentedSure, you won't be able to test anything anyway ;-). Thanks !
Comment #8
markus_petrux CreditAttribution: markus_petrux commentedCommitted
http://drupal.org/cvs?commit=238124
Comment #10
taote CreditAttribution: taote commentedThis works great. I'm using it combined with Views and Custom Fields to get a read only view of the node, but is there a way to render the group with including the empty fields?
Thanks.