Extracted from bug report #591112: "Duplicate URL Entry" error when updating node

Is there a way to get this to work with token? Our content works on [menupath-raw], is there a way to get it to do that per link item as well?

Comments

gooddesignusa’s picture

Also something I'm interested in. subscribing

scottrigby’s picture

Status: Active » Needs review
StatusFileSize
new4.93 KB

@wojtha & gooddesignusa:

I added basic pathauto integration, a [nodesymlinks-menupath-raw] token, and added 'presave' to hook_nodeapi() so we get the nodesymlinks when we need them.

@todo: Currently this only works with one nodesymlink (the last one in the list - currently i only needed one, so I only got this far). To do that I think we'd need to load a nodesymlink object rather than $node, and evaluate the token in that context.

Also, pathauto_create_alias() changed between pathauto 6.x-2.x & 6.x-1.x. Currently there is one line that needs to be commented out depending on the version of pathauto running (this could be a configuration... we could use drupal_parse_info_file() to get the correct branch but that doesnt work with cvs checkout).

Please let me know what you think, before i go farther on this.

gooddesignusa’s picture

Just a note, after applying the patch you have to go to "Automated alias settings" located @ /admin/build/path/pathauto and re save before this works.

scottrigby’s picture

StatusFileSize
new6.94 KB

Ok, updated patch:

  • Re-arranged pathauto integration in nodesymlinks_item_save()
  • now using $node->menu['nodesymlinks']['items'], rather than $node->nodesymlinks['items'], in nodesymlinks_token_values().

Works on first node save now.

Still only works for one nodesymlink per node.

Also now gets module version now using drupal_parse_info_file(), for users who download the tarball of nodesymlinks.module from d.o.
@todo: still would like to find a way to get version if downloaded via CVS.

Additionally added nodesymlinks_perm() 'administer nodesymlinks' (though this might be best as a separate patch).

wojtha’s picture

@scottrigby Nice work, I'm watchin' you ;-) When it will support multiple nodesymlinks I will integrate it.

... And yes, the nodesymlinks_perm() 'administer nodesymlinks' will be better as an separate patch.

gooddesignusa’s picture

@scottrigby thanks again for all your hard work on these nodesymlink bounties. The site I needed it for couldn't of gone live without your help. I still haven't gotten an invoice for your past work. Just send it over and I'll have my boss paypal you. Thanks again.

3Dmusings’s picture

I would be very interested in seeing support for multiple symlinks per node of this patch. Any chance its coming soon? I'd be happy to chip in a little cash to help out.

I'm working on a project with top menus items like: Athletes, Parents, Sponsors, Coaches. The sub menus share a lot of redundant links and I'd love to be able to use pathauto to get results like:

athletes/Page-1
parents/Page-1
etc

or more simply put like mentioned above:

[menupath-raw]/[link-title]

wojtha’s picture

Submitted to http://github.com/wojtha/nodesymlinks. Will release new version soon.

wojtha’s picture

From 6.x-1.0-beta2 is pathauto finally fully supported including Bulk update. However there is still no support for custom alias per symlink.

3Dmusings’s picture

Status: Needs review » Needs work

Oh wow, thanks for working on this. I will give it a test and get back to you. If you let me know where to, I'd be happy to send some money your way.

wojtha’s picture

Status: Needs work » Fixed

Custom alias per item added in 6.x-1.0-beta3 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.