- install the latest version of profile2 and entity from git
- install http://drupal.org/project/field_group
- create a new custom profile type
- add field to it and put this field into a new group
- edit your profile, browse to the tab of your profile (user/1/edit/test if your profile type is called 'test'). you will note that the fields are rendered ok in their group. all good so far
- go to create a new user at admin/people/create and note that the fields are not rendered in their group/fieldset like they are in your profile. you will also see plenty of notices like # Notice: Trying to get property of non-object in field_group_fields_nest() (line 1000 of /sites/all/modules/field_group/field_group.module).
- go to the user registration form, the same thing happens, all the fields are rendered flat with the notices.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Status: Active » Needs review
FileSize
755 bytes

I have a feeling there might be a better fix but this patch works for me...

scor’s picture

Status: Needs review » Needs work
FileSize
736 bytes

actually, the patch above breaks the form validation in profile2_form_validate_handler(). The best solution I found was to momentarily comment out the fieldset wrapping in the user creation/registration form. Does not look as good but at least it allows field_group to work, and the form validates alright.

fago’s picture

Title: field_group not working on user registration and add people form » field_group not working on user registration and add people form of profile2
Project: Profile 2 » Field Group

This is probably a problem in the field_group module, as profile2 just uses the field API attachers as documented. Perhaps field group has troubles if the field API forms are not attached to the outer most $form but in a form element?

Stalski’s picture

Hmm good question. You could be right, i'll have to check this.

Stalski’s picture

Status: Needs work » Closed (cannot reproduce)
FileSize
147.26 KB
123.2 KB

Hmm could not find any problem nor notice. Maybe fixed by drupal core upgrades or somthing.
see attached screenshots.

scor’s picture

Status: Closed (cannot reproduce) » Needs work

you didn't visit the right places. please follow the detailed instructions I gave in #0.

nils.destoop’s picture

It's a problem caused by profile2.

Profile2 idd uses correctly the field api attachers. But later in the code, he does this:

      // Wrap each profile form in a fieldset.
      $form['profile_' . $type_name] += array(
        '#type' => 'fieldset',
        '#title' => check_plain($profile_type->label),
      );

But by doing that, the whole rendering from our groups has been broken.
I'm now trying to debug a bit, so i can find what exactly makes it break.

nils.destoop’s picture

Found the problem: form_process_fieldset removes our groups.

nils.destoop’s picture

Status: Needs work » Needs review

We renamed our storage to #fieldgroups instead of #groups. I committed this change, but we'll do some testing on all our forms. Would be nice if other people also review, if everything is still working.

scor’s picture

Status: Needs review » Needs work

please provide an actual patch.

Stalski’s picture

Reverted it. Did not work all the way. see http://drupal.org/cvs?commit=480146 for more info

nils.destoop’s picture

In attachment you can find a new patch. It looks like this one doesn't break anything.

Stalski’s picture

Status: Needs work » Needs review

Tested. Works everywhere here. If the patch validates, we'll commit it unless somebody experience an issue with this refactoring?

fago’s picture

Status: Needs review » Needs work

There is comment left in the patch.

+  //$element['#groups'] = $element['#old_groups'];
Stalski’s picture

This comment will be removed in next commit, together with the patched code.

Stalski’s picture

Status: Needs work » Reviewed & tested by the community

That comment will go indeed, but it looks fine to me. Everything keeps working as it should.

Stalski’s picture

Status: Reviewed & tested by the community » Fixed

All is committed and tested.

Stalski’s picture

Stalski’s picture

Status: Fixed » Closed (fixed)
manoloka’s picture

Issue summary: View changes

Hi there,

I guess this patch doesn't apply anymore ... however I'm finding the same issue nowadays

witht

without

manoloka’s picture

Status: Closed (fixed) » Active
manoloka’s picture

I've noticed it happens when you check the "show during account registration" option in the profile type for more of one profile

Pete B’s picture

Cross-referencing #2849333: Conflict with core fieldset use of #groups causing issues - I think the patch there will solve this issue too, although I haven't tested it with profile2. Is anyone in a position to try it?

  • Stalski committed 0e73410 on 8.x-3.x
    #1006464 by zuuperman: field_group not working on user registration and...
  • zuuperman committed 5ac0a13 on 8.x-3.x
    #1006464 Change #groups to #fieldgroups because of name collapsing with...
  • Stalski committed e1348d1 on 8.x-3.x
    Reverted the fix in #1006464 , 9th comment. The node form was completely...