Basically, I want the name of a node to be replaced with the value of a certain field. So if I have a field type called field_new_name, I want the title field to be changed to that field's value.

I found this link http://dropbucket.org/node/823 but I don't quite understand what it's doing. Is this what I want?

If so, as I run this script, is there a way to build to keep track of changes? Because some nodes reference others via hrefs so I'd wanna go back and change those references as well.

  • Could you elaborate a little bit more on what are you trying to accomplish? – typologist Jul 17 '15 at 20:33

Had this question once, came along this Generating node title from node fields

In the reactions, there's a little gem in the comments: https://www.drupal.org/project/auto_entitylabel You can use Tokens and al kind of this stuff ;-). When your field is field_foobar then you'll have the tokens [field_foobar-formatted] and [field_foobar-raw]

| improve this answer | |
  • so the thing about these nodes is that they have references to other nodes in their body as they used to be html pages. Do you have any ideas as to how I'd go about updating those references? – Angie Jul 17 '15 at 20:43
  • Woha, that's very specific .. ;-) As always, there are multiple ways to do something in Drupal. This module can do references, but i'm not familiar with it: drupal.org/project/references – MatthijsG Jul 17 '15 at 20:47
  • haha alright thanks! figured i wouldn't lose much in asking. I think I'm going to go with the dropbucket code I found and use the fact that each node still knows its old name and use the drush search and replace module. still working out the details, but i'll update as soon as i figure it out. – Angie Jul 17 '15 at 20:54

Basically, this was easier than I thought. I ended up using Pathauto to create alias' based on the field I wanted and then installing Global Redirect so that the previous urls and aliases all redirected to this new alias. With the Aliases I didn't need to parse and replace references in the html page.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.