I am trying to populate nodes programmatically from a feed (migrating earlier site to Drupal 9). So far I have managed to get everything else to move, but I can't figure out, how to set video_embed_field or rather the URL-value of the video. I found an example, but it caters just youtube, but there are also other video providers used.

I have tried the following ideas:

$node->set("field_video", $videourl);

$node->field_video = ['input' => $videourl];

$node->field_video = ['value' => $videourl];

but so far nothing works.

Could anyone hint me to the right direction?


Actually, the last try in my choices seems to work after all.

 $node->field_video = ["value" => $item["video"]];

I must have done something dumb with my editor like not saving the changes... Well, maybe someone else finds the info here...

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.