Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
If you put some fields in field group, for example horizontal tab, and then hide all fields of this field group for current registration form, empty fieldgroup will be visible
I made a patch for fix problem of this issue. Using hook_field_widget_form_alter () to hide the elements it is not good idea, because in this case, hidden only element widget, but wrapper of element is displayed. Therefore, Drupal displaying empty fieldsets (when all elements widgets of filedset are hidden).
I think we need to move hiding elements operation to hook_form_user_register_form_alter().
Since the need to hide the fields in all forms, not just in user_register_form, I wrote a universal solution. So that's my third version of the patch, I think the final :)
Comments
Comment #2
Alex Liannoy CreditAttribution: Alex Liannoy at ZANZARRA Drupal Agency commentedHello Aleksey,
Could you describe this issue a bit more verbose?
Comment #3
a.sinitsa CreditAttribution: a.sinitsa commentedHi!
If you put some fields in field group, for example horizontal tab, and then hide all fields of this field group for current registration form, empty fieldgroup will be visible
Comment #4
a.sinitsa CreditAttribution: a.sinitsa commentedComment #5
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedHi!
I made a patch for fix problem of this issue. Using hook_field_widget_form_alter () to hide the elements it is not good idea, because in this case, hidden only element widget, but wrapper of element is displayed. Therefore, Drupal displaying empty fieldsets (when all elements widgets of filedset are hidden).
I think we need to move hiding elements operation to hook_form_user_register_form_alter().
Comment #6
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedComment #7
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedI get a mistake in the first version of the patch, so I made the second version.
Comment #8
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedSince the need to hide the fields in all forms, not just in user_register_form, I wrote a universal solution. So that's my third version of the patch, I think the final :)
Comment #9
omidehghanZD CreditAttribution: omidehghanZD commented@WalkingDexter
have any patches for d7 version of this module? I have same problem and need to this patch for 7.x version . :(
Comment #10
anpolimusImplemented patch in #2802911: Empty fieldsets are still present.
Patch fixes initial problem. If all fields at the field group are disabled - fieldset is gone.
Comment #11
anpolimusComment #13
Alex Liannoy CreditAttribution: Alex Liannoy at ZANZARRA Drupal Agency commentedHi guys,
Thank you for reporting the bug and preparing the patch for it.
Committed the last patch.
Comment #14
Alex Liannoy CreditAttribution: Alex Liannoy at ZANZARRA Drupal Agency commentedComment #16
W01F CreditAttribution: W01F commentedSeems to still be an issue as of:
Core: 8.6.7
Field Group: 3.x-dev
Multiple Registration: 2.6