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
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.
}
-
Here's the docs page for this... api.drupalhelp.net/api/field_group/field_group.module/function/… Commented Oct 2, 2015 at 2:35