This is a related to the old issue at #131783: depend on location?.

I'm coming at the from the perspective of a site using cck_address which wants to add Location functionality. There is also the fairly-new Location CCK module, but it isn't compatible with Google Maps at the moment. I'd like to make it easier for sites to migrate to location if they need to. By pushing cck_address information into the {locations} table, it will also make it relatively simple to use cck_address fields for google maps. It will also make it (more) doable to move to the CCK Location module as well.

Here are my plans at the moment:

  1. Add a setting to the cck_address field settings indicating that if it's saved for a node which is also location-enabled, that it should overwrite any location information stored. This should prevent accidental clobbering of data for nodes which are somehow using cck_address *and* location for different purposes.
  2. When location is installed, a node is location-enabled, and has cck_address fields, location integration will kick in. On save, the {location_instance} table will be updated with the relevant info, and a location will be added or updated to {locations} via location_save().
  3. This will be a one-way sync in this patch. The idea is that the location-module is completely behind the scenes from the user's perspective.

If anyone has any thoughts or objections, please let me know soon, as I'm about to start coding :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deviantintegral’s picture

Status: Active » Needs review
FileSize
3.51 KB

This turned out to be way simpler than I expected! Here is an initial patch which enables basic Location integration. Using this patch, I'm able to use Location functionality as expected, with geo-coding and so on.

A few thoughts:

  1. Should this patch do anything special to hide or disable the location fields? Or should we leave that in the scope of Location? It currently lets you hide all fields, but then you're left with an empty fieldset :(
  2. Should we remove the "Delete this location" checkbox?
deviantintegral’s picture

Here is an updated patch which properly sets the #default_value of the new checkbox.

NewZeal’s picture

Status: Needs review » Fixed

On the assumption that this patch is working on your site as intended, this has been added to the code for the next commit. Let me know otherwise.

NewZeal’s picture

Status: Fixed » Closed (fixed)
deviantintegral’s picture

Great - it is working in production quite nicely. Thanks!

nodecode’s picture

Version: 5.x-2.x-dev » 5.x-2.3
Category: feature » bug
Priority: Normal » Critical
Status: Closed (fixed) » Needs review

I was so excited to see Location Module integration with the new 5.x-2.3 version of this module. Unfortunately the Settings page for CCK Address is just a blank white page so I am unable to hide the Location Module's fields when using the two modules together. Can anyone using 5.x-2.3 confirm that the settings page does not work or is it just me?

NewZeal’s picture

By Settings Page, do you mean when you go inside a content type and configure a cck_address field?

No changes have been made that could affect this and I am not able to replicate this problem.

SeanBannister’s picture

Sub

nodecode’s picture

By "Settings Page" i mean navigating to "admin/settings/cck_address" where i expected to see an option to hide Location fields. anyway, that page (admin/settings/cck_address) comes up completely blank for me.

BTW i have "Drupal for Firebug" and "Devel" modules installed so i may be able to provide diagnostic info to help resolve this if someone knows what i should examine.