diff --git a/field_group.module b/field_group.module index f26421a..6b47886 100644 --- a/field_group.module +++ b/field_group.module @@ -1707,6 +1707,12 @@ function field_group_fields_nest(&$element, &$vars = NULL) { $group_references[$group_name] = &$element[$group_name]; } + // Select the good field container regarding to the entity type. + $render_container = 'content'; + if ($element['#entity_type'] == 'user') { + $render_container = 'user_profile'; + } + // Move all children to their parents. Use the flat list of references for // direct access as we don't know where in the root_element hierarchy the // parent currently is situated. @@ -1714,10 +1720,10 @@ function field_group_fields_nest(&$element, &$vars = NULL) { // Entity beïng viewed if ($vars) { - // If not a group, check vars['content'] for empty field. - if (!isset($element['#groups'][$child_name]) && isset($vars['content'][$child_name])) { - $group_references[$parent_name][$child_name] = $vars['content'][$child_name]; - unset($vars['content'][$child_name]); + // If not a group, check vars[$render_container] for empty field. + if (!isset($element['#groups'][$child_name]) && isset($vars[$render_container][$child_name])) { + $group_references[$parent_name][$child_name] = $vars[$render_container][$child_name]; + unset($vars[$render_container][$child_name]); } // If this is a group, we have to use a reference to keep the reference // list intact (but if it is a field we don't mind).