diff --git a/nodeformcols.admin.inc b/nodeformcols.admin.inc index 79d422b..4f8e0b1 100644 --- a/nodeformcols.admin.inc +++ b/nodeformcols.admin.inc @@ -21,6 +21,20 @@ function _nodeformcols_get_node_type_form($type) { ); $fs += form_state_defaults(); $nf = drupal_retrieve_form($nfid, $fs); + // Add in field_groups if they exist. + if (module_exists('field_group') && !empty($nf['#groups'])) { + foreach ($nf['#groups'] as $group) { + $group_title = $group->label . ' (' . t('Field group') . ')'; + $nf[$group->group_name] = array( + '#group' => $group, + '#weight' => $group->weight, + '#title' => $group_title, + ); + foreach ($nf['#groups'][$group->group_name]->children as $group_field) { + unset($nf[$group_field]); + } + } + } drupal_prepare_form($nfid, $nf, $fs); drupal_process_form($nfid, $nf, $fs); return $nf;