Drupal-folks,
First of all: Merry Christmas to all...
Fiddling with some Drupal 7 module development while the goose is in the oven.
I'm coding a conversion module that takes content from a custom CMS and creates nodes in Drupal 7. Things are working fine, but I'm wondering about one thing: When creating a new node programatically in Drupal 7, I can easily make a URL alias by adding the code
$node->path = array('alias' => $old_article_path);
This will nicely create an alias to the old URL when I save the node, and make sure that no links break in the new system.
But in the old CMS (like in Drupal) I could have several paths to the same article. How do I do this in Drupal 7? I have looked online for answers, but been unable to find them. I have also dissected the path and pathauto modules for Drupal 7, but to no avail.
Any ideas?
Martin
Comments
Using hook_node_insert() and hook_node_update() for this
Hi,
This is very old post but the same problem I had also faced in past. To create multiple URL alias for one node, I have implemented hook_node_insert() and hook_node_update().
Sample Code :
I have write the same code in hook_node_update() hook, it works fine as per my requirement. But recently I got one issue that come very seldom, sometimes when user save the node for article content type hook_node_insert() function did not get call and wrong URL alias get produced. This problem comes very rarely and after clear cache/cron run it again start works fine.
I am unable to find why this hook function dint called some time. If any body have faced this issue then please share with me because it creates wired situation sometime.
Pushpinder Rana #pushpinderdrupal
Acquia Certified Drupal Expert