Hi again,
I'm using Drupal 7.9, Location 7.x-3.x-dev and Location taxonomize 7.x-2.x-dev.
Node locations are taxonomized great, but if I try to use field locations provided by Location CCK submodul of Location, creation of a node with this field doesn't produce any taxonomy terms.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kvit’s picture

Status: Active » Closed (won't fix)

I'm closing it myself as I think this issue belongs to Location CCK and it won't be fixed due to #1346746: Roadmap for next gen location (7.x-5.x)

cbeier’s picture

Status: Closed (won't fix) » Active

I think the support of Location CCK is very helpful. Actually, everythink works, only after saving the "location_taxonomize_location_submitt" is not executed, because the submit handler is not set.

cbeier’s picture

Status: Active » Needs review
FileSize
1.99 KB

Attached a patch for the support of Location CCK. A combination of Location Node and Location CCK should be possible (not tested).

At the moment it is assumed that the CCK field has the name 'field_locations'.

goron’s picture

Assigned: Unassigned » goron
goron’s picture

If other people are using this patch successfully, please post here to let me know, which will mean I will need to test less. Thanks.

goron’s picture

cbeier, are you using this patch?

cbeier’s picture

goron: Yes, also in production.

goron’s picture

Category: bug » feature
Status: Needs review » Needs work

Patch seems mostly fine to me. The only problem is the hardcoded name for the field. Is there no way to detect whether there is a location cck field on the form (short of looping through all the form elements)? If not, could do one of the following:

  1. Add UI in the admin form to select fields to taxonomize from a multiselect list populated with all fields of type location cck on the site. Try to access those on every node submit :-/
  2. Implement hook_field_widget_WIDGET_TYPE_form_alter(), which, if called with location cck field type, adds a process function to the field which in turn makes a note in the form_state array that that field should be taxonomized. This is how location_taxonomize_af does it. This does add complexity to the module, but I think it's a cleaner solution than #1.

cbeier (and anyone else interested), if you have any time for this your thoughts and/or another patch would be welcome. I'm a bit swamped at the moment, so I don't know when I'll have time to implement this.

RaulMuroc’s picture

Assigned: goron » Unassigned
Status: Needs work » Active

Some advance on this?

I tested the patch. It worked fine with Location CCK fields. It bulked all location cck to the newly created vocabulary as terms having a hierarchical term listing with Countries as parent terms and Cities as child terms.

I would recommend to create a new checkbox: " Location - Location CCK" in the Modules list. Currently there are "Location and Location - Address Field" so an extra box would clarify either you want to use for Location itself or Location CCK fields when you are going to active module.

Furthermore as commented in: #1541310: Get Location Taxonomize to work all entities, not just nodes it does not work nicely for Location CCK fields in Profile2 content type: Is true that I have the Hierarchical list of terms, but whatever I click on Countries or Cities it redirects to an empty page saying " There is currently no content classified with this term. "

So now we should all work to implement patches to work it for all entity types, specially Profile2 because I think there is the place most often used.

Thanks for great work.

wemmies’s picture

I can confirm that the patch is working. Have to do some more extensive testing, but is looking good so far. Only problem is indeed the hardcoded fieldname, but that's not a big issue for me.

Thnx

danon1981’s picture

I can confirm the patch is working and would really appreciate if support for taxonomizing the location cck field on node save would be moved into the next module update.

Only problem I face is that I set the address on a node through rules and also save the entity from rules. That does not trigger the location to be taxonomized. It only works when actually using the manual save action on the node itself. I think this should also work, I don't know if this would have worked without the patch, can't check.

klaasvw’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.73 KB

Here's a slightly different approach. It will use the bulk function instead and works by checking for the linked location directly. This works with any type of module that saves location data and it unifies the way data is saved. This also means it will work with any field name.

I also tried using the entity/node insert and update hooks but this will cause an infinite loop because saving the taxonomy term also uses node_save. Maybe something for a different issue?

Berliner-dupe’s picture

He klaasvw,

thank you for this patch. After i used your patch although i get 3 Notices (php Notice: Undefined property: stdClass::) but i fix it with if (isset(...)) quickly.

After this it works perfect with all location-cck-fields.

Great! Thank you very much - your Patch help me a lot.

Best Regards Matthias

balajidharma’s picture

Here i am using hook_field_widget_form_alter to get the location fields.
This patch also support multiple location fields in same node.

Let me know if you have any issues

balajidharma’s picture

Attached a updated patch for the support of Location CCK.

QNDY’s picture

Thanks for the patch! It works great but unfortunately I get a fatal error when using multiple locations

balajidharma’s picture

Hi Quinten,

Kindly upload the error page screenshot, it will help to resolve the issue.

Thanks,
Balaji D

QNDY’s picture

When im entering 2 locations I get this fatal error. It does not save it and jumps back to create the same node! And I get this also when I leave the location field empty. Futhermore I get 'Notice: Undefined index: #node_edit_form in location_taxonomize_form_alter() (line 35' when editing the location field.

QNDY’s picture

Did some extra tests. And the following will give an error: when the location field is set to unlimited it gives the error but when it is changed to for example 2 values it works.

balajidharma’s picture

balajidharma’s picture

Hi Quinten,

The mentioned issue has been resolved, kindly apply this patch and verify.
Let me know if you have any concerns

Thanks,
Balaji D

QNDY’s picture

Hi Balajidharma,

I can confirm that it works! Great work.

I only get this small notification when editing the location field:
Notice: Undefined index: #node_edit_form in location_taxonomize_form_alter() (line 36

Already before the latest patch. Nevertheless the functions are working perfectly!

3magnus’s picture

The patch in #21 works for integration with both Address Field and Location, since you set 'field_locations' as machine name for your address/location field.