This issue is part of meta issue #1931088: [META] Fixing tests

The location fieldset is nested inside an empty parent fieldset, which is probably not needed even with multiple locations.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RumpledElf’s picture

There's a setting in the admin for that field that says "Make the location box collapsible" but it doesn't do anything ...

Otherwise, I second having at least some option to not have fieldsets in fieldsets. Thinking a hook form alter is the go in the meantime.

Xomby’s picture

I got as far as adding

    $form['#title'] = '';

just under line 1868 in location.module, which removes the outer fieldset's title.

Full block now looks like:

// Tidy up the form in the single location case.
  if ($numforms == 1) {
    $form[0]['#title'] = t('Location');
    $form['#title'] = '';
    // If the user had configured the form for a single location, inherit
    // the collapsible / collapsed settings.
    $form[0]['#collapsible'] = $form['#collapsible'];
    $form[0]['#collapsed'] = $form['#collapsed'];
  }

Note-- you could swap the result from the $form[0] line with the $form line to remove the inner fieldset's title instead.

I'll have to dig into the code more to find out where the display function is, and it might require the rewrite or addition of a function to display/process a single location element instead of the current fieldset[]=>location element. (sigh)

sigent’s picture

a temporary (but simple) solution using CSS:
"
fieldset.locations fieldset.location {border: 0; margin: 0; padding: 0}
fieldset.locations fieldset.location legend {display: none;}
"

Jolidog’s picture

Title: Remove nesting » Remove nested fieldset when only one location is used
FileSize
2.06 KB

Did a quick patch, not sure if it the correct approach, but it's working for me.

OMD’s picture

Same issue here. Double fieldset for just one field, make the form look awkward. Even removing the border and legend as in #3 helps a bit, but an awkward spacing is left over. Would be nice if there was a checkbox to remove the fieldset when not desired.

iva2k’s picture

Status: Active » Reviewed & tested by the community
FileSize
6.14 KB

Improved patch #3 (added a fix for non-collapsible fieldset problem). Potentially fixes #1044290: The method of making location_element elements collapsible is flawed.

podarok’s picture

Status: Reviewed & tested by the community » Postponed

postponed before tests fix
#1931088: [META] Fixing tests

podarok’s picture

Status: Postponed » Needs review

#1931088-3: [META] Fixing tests mostly fixed for 7.x-3.x branch
this one needs review

podarok’s picture

Title: Remove nested fieldset when only one location is used » [Needs Tests]Remove nested fieldset when only one location is used
Status: Needs review » Needs work
Issue tags: +Needs tests

#6 commited pushed to 7.x-3.x
thanks!

Good to see some tests here #1931088: [META] Fixing tests

RaulMuroc’s picture

So this has been pushed/commited, hasn't it? should we mark this as fixed or needs more testing?

RaulMuroc’s picture

Issue summary: View changes

Updated issue summary.