Even when I turn off all the fields (Attachment 1) the "Additional" field still shows up on the edit form. This appears to be because location_locationapi() is returning a default set of fields:

    case 'collection default':
      return array('name' => 1, 'street' => 1, 'additional' => 1, 'city' => 0, 'province' => 0, 'postal_code' => 0, 'country' => 1);

and this is merged it with $element['#location_settings'] (which has NO value for "additional" - meaning that it takes the value from the default). I can work around it by checking for this situation using the IF clause in the following code:

  $element['#location_settings'] = array_merge(location_invoke_locationapi($dummy, 'collection default'), $element['#location_settings']);
  if (!isset($element['#location_settings']['additional'])) {
    unset($element['#location_settings']['additional']);
  }
  $element['#default_value'] = array_merge(location_invoke_locationapi($dummy, 'default values'), $element['#default_value']);

but suspect that the real problem is that $element['#location_settings']['additional'] should have been set properly in the first place..

Comments

lyricnz’s picture

Status: Active » Needs review
StatusFileSize
new658 bytes

Disregard the code "fix" in this issue, it has a logic bug. Here's a better one (though it still may not be the most correct solution)

j0rd’s picture

I think this is the same issue as this:

http://drupal.org/node/356058

bdragon’s picture

Status: Needs review » Closed (duplicate)