Closed (works as designed)
Project:
Location
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2011 at 10:12 UTC
Updated:
27 Apr 2017 at 21:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mjcarter commentedI'd also like to find an easy way to do this - for example I'm making a scheduled route and need to associate a time with each location.
Comment #2
rooby commentedThere are a few approaches I can think of.
1. This is the best, easiest and most guaranteed to work.
- Create a custom module to extend the location module with extra fields. For examples of this, the location_phone and location_fax modules do exactly this. For example:
- 1. copy the location_fax module to sites/all/modules (or wherever you want it).
- 2. rename it to something new, like location_notes (rename the folder and files).
- 3. change all occurrences of location_fax with location_notes. After this you should change any left over occurrences of fax to notes.
- 4. If your new field is not a normal textfield you might need to alter the views support slightly to suit.
2. Drupal 6 only, although there may be drupal 7 solutions around for similar functionality. It also may not be compatible with location cck fields.
- CCK 6.x-3.x has multigroup fieldgroups, so you can just create additional cck fields and add them to a multigroup with your locations. Note that the functionality cck 6.x-3.x provides is not guaranteed to ever have an upgrade path to drupal 7 and will never be merged into cck 6.x-2.x (as far as I'm aware).
3. Requires a decent knowledge of drupal coding/theming. May be quite hard to get the results you desire. Add a new cck field (or fields) to your node and then theme/form alter your node edit/view pages so the extra fields and location field are integrated the way you like.
Also note that you can't use hook_form_alter() on the individual sub-location fields (like country), you need to use the hook_locationapi() hook instead. There are some examples of modifying the location fields in the issue queue if you search for locationapi or hook_locationapi.
Comment #3
giorgoskYes that would work
but I would be nice to have such functionality out of location module
I will make this a feature request and I will let the maintainer think about it
Comment #4
rooby commentedWell I am a co-maintainer and my two cents are:
The location module is for location data. So technically all it should provide is locative fields. It shouldn't really even have phone and fax as they are not locative.
A common problem with software is that you have a product, then over time you keep adding new functionality as it is required and it get all bloated and turns into a big mess. If we add another field for something, like an email field, then someone comes along and wants a website field, then maybe a business hours field. Eventually we end up with a huge module that is all over the place offering features already available elsewhere, like the email, link, date and cck modules.
If we keep adding we end up with a module that provides an entire node out of the box, with fields for everything. That is basically what CCK does already and isn't described by the module name location.
I think the better solution, if this is something that lots of people want, is to create a new module (location_extra or something) on drupal.org that extends the location module with any number of additional fields that people want.
That way that module can have a maintainer who has time to maintain all that new code.
The location module already allows for this type extensibility and it would be pretty easy for someone to make such a module.
Another point is that while drupal 6 is still supported and will be for some time, most peoples focus is drupal 7 because there are only so many hours in the day so you have pick and choose what you spend time on. So mostly new features will go to the drupal 7 area. In addition to this, location 7.x-3.x is a temporary placeholder for a new version 7.x-4.x, which when it is done will quite possible not do any storing of locative information and instead will probably utilise a module like Addressfield to handle the storage of locative information, and then just add additional functionality on top of that, like geocoding etc. For discussion on that see #1063920: Integration with addressfield / geofield modules.
Drupal 7 is also likely at some point to have a decent solution for grouping multiple fields together, like the Field collection module.
All this leads me to believe it would be a waste of time and unnecessary to go adding more fields to location.
bdragon might think differently about this but I have my doubts.
Comment #5
rooby commentedAlso, in addition to the 3 potential solutions in #2 you could also add a new cck field for whatever you like, then to get your required output for the additional fields and location field you could use views, and then display the view on your node page in a block and hide the regular field displays.
You can also use the panels module or custom theming to position the views block around your other fields in a more flexible manner.
Comment #6
rooby commentedAlso, in case it got lost in the #4 post, a drupal 7 alternative for cck 6.x-3.x multigroups is Field Collection.
Comment #7
awasson commentedI used method #1 in D7 and I am able to add "notes" or whatever field value I want to the location data however I can't seem to display the added field in my user profile page. I've used the example of a 'location_notes' module from a copy of the location_fax module. find-replace 'fax' for 'notes' and made sure info was looking correct. Everything works no problem, I can even activate the user_location_table view and display the data but I can't display the data in my user profile page.
Drupal 7.8
Location 7.x-3.x-dev
Am I missing something?
Thanks,
Andrew
Comment #8
qriz commented@ awasson have you activated the module?
have you set the field to allow (instead of do not collect)?
Comment #9
awasson commented@qriz: I ended up abandoning that direction some time ago. I had actually forgotten about it but I'll go back and review to see if I had set to allow instead of do not collect.
Thanks,
Andrew
Comment #10
pauln600 commented"The location module is for location data. So technically all it should provide is locative fields."
I agree with this completely - there are, however, some examples of location fields that you might
consider. Many cities have districts or wards defined within their boundaries in one form
or another... Shinjuku in Tokyo, for example. As more cities become huge through growth
and/or amalgamation, I think this will become more of an issue, and the concept definitely
falls with the location information bin.
Paul N.
Comment #11
ankur commentedTo echo what rooby says in comment #4 here, use the field collection module: http://drupal.org/project/field_collection to collect other fields with the location fields.
Comment #12
sagar ramgade commentedHi,
I had created a module to add address 3 field for one of my clients, I had attached this in a module for drupal 7 in case anyone needs can use this.
Regards
Sagar
Comment #13
tonebari commentedAs per #7: I have gone to the trouble to come up with a functioning module to add a location description with a text field. The value appears in the node location array as expected, but doesn't get themed. I could use a little direction on setting up theming for a new field that has no existing theming ( think this is my issue ). Thanks.
Comment #14
rooby commentedHave you tried adding it to the template file location.tpl.php?
Comment #15
tonebari commentedThank You! :-) That was almost too easy.
Comment #16
franciscocorrales commented#12 Thanks Sagar Ramgade !