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

smitty - September 25, 2007 - 14:13
Title:Make field 'additional' optional» Make field 'additional' optional and add fields 'county' and 'quarter'
Status:active» patch (code needs review)

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.

AttachmentSize
locationfields.patch9.3 KB

#2

smitty - September 25, 2007 - 16:51

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

smitty - September 28, 2007 - 12:40

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

AttachmentSize
locationfields-2.patch9.24 KB

#4

smitty - February 2, 2008 - 07:00

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

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

#5

activelyOUT - June 11, 2008 - 06:44

subscribing

#6

rkr - October 12, 2008 - 16:06

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

AttachmentSize
2008-10-12_1754.png155.32 KB

#7

asmo75 - October 17, 2008 - 21:14

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)

AttachmentSize
Bez nazwy.jpg59.05 KB

#8

mrgoltra - October 23, 2008 - 07:36

Good Day to All,

I was wondering any problems with the patch?

Thank you,

Mark

 
 

Drupal is a registered trademark of Dries Buytaert.