3

There doesn't seem to be a way to join the fieldset table in the database to a fields table, nor any function that can be used to get fieldset info by field name. Is there a way to get fieldset info starting from a single field's information (as well as bundle and such)?

1 Answer 1

1

If you call field_group_info_groups with the entity type and bundle, it will return all the field groups on the bundle, the fields should be in the children array under ['form'][YOUR_FIELDGROUP] e.g.

     $fieldgroups = field_group_info_groups('node', "YOUR_NODETYPE");
     $field_names = $fieldgroups['form']['YOUR_FIELDGROUP']->children;

$fieldnames should now contain a list of all the fields that pertain to YOUR_FIELDGROUP. Which you can now parse through using a foreach loop.

     $node = node_load(2);
     foreach ($field_names as $key => $field_name) {
      $field_items = field_get_items('node', $node, $field_name);
      // Do something cool here. 
     }
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.