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.
I'm wirting a set of custom import scripts to import my nodes from site A to B, and I have several hundred nodes with video fields...
I have tried both node_save & drupal_execute ways of creating my nodes, with assigning the relative cck fields for video... but it just doesn't save to the database.
Is there a simple example of how you can use emfield programmatically?
Comments
Comment #1
joejoejoew CreditAttribution: joejoejoew commentedTry this:
Comment #2
the_g_bomb CreditAttribution: the_g_bomb commentedAs an alternative to the above, have you thought about using the http://drupal.org/project/feeds module?
I have a custom importer setup using it, create a view on site A that outputs XML, csv, or any other format pick your preference as long as feeds supports it. Then create an import profile on site B, map the relevant fields and import away. It may just save you having to hand code eveything.
Comment #3
jibranThis code works fine for me.
Comment #4
Llewellyn CreditAttribution: Llewellyn commentedHi there jibran
Does the embed code have to be a specific format?
Comment #5
jibranYou can add any code as long as you have enabled respective extended module(s). i.e. media_youtube, media_vimeo etc.
I hope this helps.
Comment #6
Llewellyn CreditAttribution: Llewellyn commentedThanks will give this a try.
Comment #7
Steven Brown CreditAttribution: Steven Brown commentedI'm needing this same thing but in D7. Anyone know how I should do it?
Comment #8
atin81 CreditAttribution: atin81 commentedTry with this code:
Comment #9
aaron CreditAttribution: aaron commentedComment #11
rakesh.gectcr