Main menu

Drupal 7: Copying fields inside nodes using VBO

Published by dnovikov on Sat, 01/05/2013 - 18:38

I want to describe a good (and the most correct one in my opinion) way how to batch copy node field into another field of the same node. It should work also for any entities.

The topic of this article is covered here: http://drupal.org/node/1000200, but with one exception - you need to know some basics of PHP to copy data between fileds. I want to show you some possibilities of copying data without a need to write a single line of code.

1. First of all, install Views Bulk Operations module and its prerequisities. Enable also Entity tokens module:

Suggest that we have a content type with the default Title field, and custom Page Title field, which can be used for SEO purposes (to set <title> HTML tag for example).

(This obviously can be done with Page Title module).

For the very first time we need to fill Page Title field with at least default node Title. Maybe we will also add something like categories to Page Title in the end.

 

2. Now create a view for bulk operations

 

3. Add bulk operations field to it.

 

4. Choose "Modify entity values" and the field which you desire to change.

 

5. Now you're almost there. Visit your newly created view, and choose appropriate operation, and "Select all items on all pages" checkbox.

 

6. After pushing "Execute" button you'll be get to the screen, where you can specify any value for the Page Title field. Any value - including tokens!

Put two tokens there:

 

7. Proceed to the batch screen and wait for a while.

Voila, now we have an updated Page Title field without any single line of code!

Comments

How to do it, if the the target is a taxanomy field. in this way it will create multiple taxanomy terms (even the term is same name)

Wonderful to find this explanation. Saved me lots of time.

I have tried to figure out VBO for some time.
The cat's meow!

I can't use tokens, as I would like to use the multi-select widget.

Can I use VBO with custom php?

Any tips on the code?

Can I use VBO with token php ?
ragards

Hi,
I have a date field and want to copy the date of creation to that date field, do you know a way to do that?
Thanks

Hi, thanks so much for this post.

Just an FYI, in order to get Available Tokens to show on Drupal 7, I also had to install the "Token" module. (In addition to enabling Entity tokens.)

You explained your technique using images. However, your images are missing so the article is not very useful.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.