I use Vertical Tabs and its addon module Vertical Tabs Default Tab that place the default fields (title, language, body & input format) in a tab (à la D7) and the other fieldsets in their own separate tabs (different ones for Menu settings, Authoring information, Revision information, Publishing options, URL path settings and so on).

The way it is now, the 'Location' fieldset in the node create/edit form is rendered along with the default node fields. When someone uses the above mentioned modules, this causes the 'Location' fieldset to be rendered in the default settings tab (the one provided by Vertical Tabs Default Tab). This in turn causes the tab to be really long when the 'Location' fieldset is expanded, which actually makes the use of vertical tabs lose its purpose.

I think that this could be solved if the 'Location' fieldset was rendered in its own collapsible fieldset (Vertical Tabs would pick it up automatically and place it in its own 'Location settings' tab).

Thanx in advance for considering this one.

PS: If I am wrong and this issue should be handled by the modules in question, please let me know so I can take it there.

Comments

klonos’s picture

I think this would provide a more solid solution rather than any hack provided in this issue #772766: Move the 'Location' fieldset in its own vertical tab (in the Vertical Tabs module's issue queue).

PS: it is strange how nobody else has commended here (judging by both modules' usage stats). Doesn't anyone else have a problem with this? I am really curious to see what others think on this one.

dnotes’s picture

Heh yes this is definitely an annoyance and yes I'd like it fixed... what I've done is a form_alter on node forms and move $form['locations'] to $form['location']['locations'], then unset the $form['locations'] and it works. But... it would be very nice if this could happen by default.

vlooivlerke’s picture

subscribe

I have given up. Was a big Fan of Vertical Tabs, but a bigger fan of Location module. Now I use nodecolums.module to style my node form to make location look better. But vertical tabs would be nice

jp.stacey’s picture

+1 for this. It sounds like it could be a straightforward fix from this comment on #354920: Support for location module (a.k.a Move the 'Location' fieldset in its own vertical tab):

it seems that if you select a max number of locations greater than 1 (on the content type edit page), it will add the locations fieldset to vertical tabs.

i'm using the form module, and once i changed the max number, the locations fieldset appeared on the form configuration page.

this seems to have something to do with the double fieldsets that the locations module uses when there are multiple locations.

(http://drupal.org/node/354920#comment-2438850)

jp.stacey’s picture

Looking through the codebase, the following pseudocode modifications in location_form() would "fix" Location for Vertical Tabs. Try adding && !module_exists('vertical_tabs') twice in the two if statements as follows:

/* ... */
  // If there is only one form, hide the outer fieldset.
  if ($settings['multiple']['max'] == 1 && !module_exists('vertical_tabs')) {
    $form['#type'] = 'markup';
  }
/* ... */
  // Tidy up the form in the single location case.
  if ($numforms == 1 && !module_exists('vertical_tabs')) {
/* ... */

Note: I don't recommend this as the actual contrib fix, although it will work for you if you're happy hacking your own copy of the module! But these are the two "pinch points" where what Location does is just not correct for what Vertical Tabs wants to see.

The problem is that the UX suffers a little bit as a result, but maybe that's OK. Can anyone on the Location or Vertical Tabs projects help with suggesting the most reasonable behaviour for this code, without introducing a cross-dependency between the two modules? I hate using module_exists() if I can avoid it.

bryancasler’s picture

Thanks for your work jp.stacey, I will use your hack for the interim. +1 For a proper fix.

yesct’s picture

Issue tags: +location useful code

per #5 adding a tag

barry_fisher’s picture

Component: Code » User interface
Category: bug » feature
Status: Needs review » Active

I came across this as well. Thanks to jp.stacy for his pointer. It led me onto this following solution for me. The locations key doesn't appear to get populated into the $form array at the point of a regular form_alter(), but it is after the form has been fully built- therefore I needed to enter the #after_build to perform the action I needed:

/**
 * Implementation of form_alter().
 */
function {my_module}_form_alter(&$form, &$form_state, $form_id) {
  // For all node forms, change location to a fieldset so it'll
  // be picked up by vertical tabs
  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
    $form['#after_build'][] = '{my_module}_put_location_in_vertical_tabs';
  }
}

function {my_module}_put_location_in_vertical_tabs($form, &$form_state) {
  if($form['locations']) {
    $form['locations']['#type'] = 'fieldset';
    $form['locations'][0]['#type'] = 'markup'; // I also wanted to remove the child fieldset as I only have one location element set
  }
  return $form;
}

Hope that helps.

Barry

klonos’s picture

Thanx for sharing your solution Barry, but I would love to hear what the maintainer(s) think on this issue and perhaps provide a solid solution if they agree.

kndr’s picture

StatusFileSize
new1.92 KB

Tkanks for solutions #5 and #8. My method is different. No module_exists() but pure CSS is enough when code is modified a bit. I am attaching the patch.

kndr’s picture

Component: User interface » Code
Category: feature » bug
Status: Active » Needs review
kndr’s picture

StatusFileSize
new1.93 KB

I've tested #10 and found one mistake. Class 'location' should be also add to single-location fieldset. Without this, some css rules don't work. I am attaching new patch.

klonos’s picture

Give me some time to test this Konrad and I'll be coming back with feedback.

cameron tod’s picture

subscribing

aaronbauman’s picture

Component: User interface » Code
Category: feature » bug
Status: Active » Needs work

Seems like patch in #12 does not add support for Vertical Tabs.
It may work for adding support for Vertical Tabs Default Tab, but I do not use that module.

kndr’s picture

I am successfully working with Vertical Tabs and Vertical Defaul Tab after applying #12 for long time. Did you test this or just saying that it doesn't support Vertcal Tabs?

klonos’s picture

Ping? I'm working on D7 and trying to switch my other setups from D6 too. Any chance the maintainers will have a look at this?

vlooivlerke’s picture

StatusFileSize
new978 bytes

Hi here is a small module to put location in vertical tabs

castawaybcn’s picture

vlooivlerke's module works beautifully, thanks!!

monsoon’s picture

@vlooivlerke

Can you please make this module available for Drupal 7?

I need this fix as soon as possible.

Thanks,

Berliner-dupe’s picture

For D7 with this module you can move Location-Fieldset to vertical Tabs from "Field Group"

https://drupal.org/project/rel

legolasbo’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing old D6 issues as D6 is end of life