Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
i use node_convert to convert node from content type to another
How i can convert node type with "media_youtube" field to anothe type node with "youtube" field.
"youtube" and "media_youtube" is two drupal module using youube link to creat image ad video insid node.
Thanks.
Log in or registe
Comments
Comment #1
guschilds CreditAttribution: guschilds at Chromatic commentedHey rachidik,
I've never used the Node Convert module before, but I went ahead and gave this a shot.
I installed Drupal with Node Convert, YouTube Field, and Media: Youtube. I created a content type with a YouTube Field field and another content type with a Media field. I went to the Node Convert screen to create a template to convert the Media field to the YouTube Field field. I ended up at a form that read:
My options were:
I looked into how that form was built to determine how it was creating those options. I ended up on this code within node_convert.forms.inc:
Notice the comment,
Insert destination type fields into $options that are of the same type as the source.
, and code underneath it. Apparently this module will only convert fields that are the same type. YouTube Field fields and Media fields are not the same type so I don't think this module could be used to do this.These modules also appear to store data in very different ways. If you were to write custom code to accomplish this, you'd probably have to reach for the file entities stored by the Media module, extract the YouTube ID from their uri, and save that ID in the YouTube Field's row. Yikes!
Sorry this wasn't easier, but I hope the answer helps!