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?

Comments

smitty’s picture

Title: Make field 'additional' optional » Make field 'additional' optional and add fields 'county' and 'quarter'
Status: Active » Needs review
StatusFileSize
new9.3 KB

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.

smitty’s picture

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?

smitty’s picture

StatusFileSize
new9.24 KB

I found a little bug in the patch, which is now fixed. Please use the attached locationfields-2.patch.

smitty’s picture

Has anybody experienced this patch? Are there any issues with this?

It would be nice to have this functionality in the next release.

socialnicheguru’s picture

subscribing

rokr’s picture

StatusFileSize
new155.32 KB

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

asmo75’s picture

StatusFileSize
new59.05 KB

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)

mrgoltra’s picture

Good Day to All,

I was wondering any problems with the patch?

Thank you,

Mark

jerry’s picture

Subscribing.

j0rd’s picture

I believe this is the same issue as this:

http://drupal.org/node/356058

yesct’s picture

yesct’s picture

Status: Fixed » Closed (fixed)