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
Comment #1
lyricnz commentedDisregard 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)
Comment #2
j0rd commentedI think this is the same issue as this:
http://drupal.org/node/356058
Comment #3
bdragon commentedMarking as duplicate of #372377: [master] Decide how Additional field should work.