Drupal 8 Programmatically Add Youtube Video to Video Field

leopathu on Thu, 07/23/2020 - 23:10

Drupal 8 gives various type of fields includes the video field. In the video field there is an option to add different kind of videos like upload, youtube, vimeo, wistia videos to the drupal fields. When you create a node programmatically we have to set values to the custom fields. Normally we set the values to the fields in the following way,


Unfortunately it wont work for the video field, we have to do it in a different way like the following code,