Most form elements have a #type set. In fact, all valid form elements except one kind have that.
This is in drupal_render():

  // If #markup is set, ensure #type is set. This allows to specify just #markup
  // on an element without setting #type.
  if (isset($elements['#markup']) && !isset($elements['#type'])) {
    $elements['#type'] = 'markup';
  }

However, field_group_remove_empty_form_groups() ignores this distinction, and removes anything without a #type.

Additionally, it loops unnecessarily. Once it finds one child, it can stop looping.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
726 bytes

Here's the fix.

nils.destoop’s picture

Status: Needs review » Fixed

The check for markup has been added, but the break not.
The loop should always continue, if you break in the loop, it's possible that one of the level 2 children didn't got an #access FALSE. (it goes recursive into all the children, and children childrens)

tim.plunkett’s picture

Status: Fixed » Reviewed & tested by the community
FileSize
2.51 KB

Good point.
However, you committed a little bit more than necessary.
Here's a patch to reduce the last commit to only fix the bug.

For posterity: http://drupalcode.org/project/field_group.git/commit/c6176eb

nils.destoop’s picture

Yeah, i already noticed it :D The debug code was already removed.

nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit c6176eb on 7.x-1.x, 8.x-1.x authored by tim.plunkett, committed by zuuperman:
    Issue #2212431 by tim.plunkett: Field groups that contain only elements...

The last submitted patch, 1: field_group-2212431-1.patch, failed testing.

Status: Closed (fixed) » Needs work

The last submitted patch, 3: fg-2212431-3.patch, failed testing.

nils.destoop’s picture

Status: Needs work » Closed (fixed)