Created
March 25, 2013 14:09
-
-
Save karelbemelmans/5237358 to your computer and use it in GitHub Desktop.
Drupal 7 code to attach a video to a node using the media_youtube code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
module_load_include('inc', 'media_youtube', 'includes/MediaInternetYouTubeHandler.inc'); | |
$obj = new MediaInternetYouTubeHandler($url); | |
$file = $obj->getFileObject(); | |
$file->display = 1; | |
file_save($file); | |
$product->field_product_video[LANGUAGE_NONE][] = (array) $file; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment