Make field 'additional' optional and add fields 'county' and 'quarter'
smitty - August 9, 2007 - 09:02
| Project: | location (API, module) |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
Whenever you require street locations to be submitted for a content type, not only the field 'street" shows up, but also the field 'additional'. I do not need this field and would be happy if I could define 'Do not collect a street additional location for content of this type'.
I added this code to the function location_form_alter
$form['location']['location_additional'] = array(
'#type' => 'radios',
'#title' => t('Street locations additional'),
'#default_value' => variable_get('location_additional_'. $type, $default),
'#options' => array(t('Do not collect a street additional location for content of this type.'),
t('Allow street additional locations to be submitted for content of this type.'),
t('Require street additional locations to be submitted for content of this type.'))
);But this causes only the radios to show up in the content type definition. I could not find where to evaluate 'location_additional_radios'.
Who can help?

#1
The attached patch makes the field "additional" optional, so the admin can choose, if he wants the field to be displayed in the document form.
Furthermore this patch adds the fields "county" and "quarter" to collect information about the administrative district of the location and the quarter of the city in which the location is located. Both fields are optional, so the admin can choose, if he wants them to be displayed in the document form.
The patch was made against the version 5.x-1.x-dev / 2007-Aug-23.
This is my first patch submission so please let me know, if I did something wrong or if you have better ideas to get those field in.
#2
I forgot to mention, that for this patch you have to upgrade the database:
In the table "location" you have to insert a field called "quarter" (after the field “additional”) and a field called "county" (after the field “city”). Both of them should get:
typ = carchar(255)
kollation = utf8_general_ci
Null = null
standard = NULL.
I did this via the phpmydadmin.
Could anybody tell me how I could write a script for this or what I would have to do to enter this into the location.install?
#3
I found a little bug in the patch, which is now fixed. Please use the attached locationfields-2.patch.
#4
Has anybody experienced this patch? Are there any issues with this?
It would be nice to have this functionality in the next release.
#5
subscribing
#6
It would be nice to enter a location *only* with Gmap widget. When all location fields are disabled in content type -> location fields the field "additional" is still appearing which isn't needed. Or did i miss a setting? Removing it via form_alter is a way but i thought i'm asking before i go this way. There is a screenshot attached. Using GMap 5.x-1.0-rc1 and Location 5.x-3.0-rc1.
cheers, Ronald
#7
i have the same with Drupal 6 and 6.x-3.0-rc1
ps.
i have second problem with firefox with format of page (see attched file)
#8
Good Day to All,
I was wondering any problems with the patch?
Thank you,
Mark