function emfield_content_generate in Embedded Media Field 6.3
Same name and namespace in other branches
- 6 emfield.module \emfield_content_generate()
- 6.2 emfield.module \emfield_content_generate()
Implementation of Devel module's hook_content_generate().
File
- deprecated/
emfield-deprecated.inc, line 757 - Functionality to be deprecated from earlier versions of Embedded Media Field.
Code
function emfield_content_generate($node, $field) {
$item = $urls = array();
$module = $field['module'];
foreach (emfield_allowed_providers($field, $module) as $provider) {
$provider_urls = emfield_include_invoke($module, $provider->name, 'content_generate', $node, $field);
if (is_array($provider_urls)) {
$urls[$provider->name] = $provider_urls;
}
}
if (!empty($urls)) {
$provider = array_rand($urls);
$item['provider'] = $provider;
$key = array_rand($urls[$provider]);
$item['embed'] = $urls[$provider][$key];
$item = _emfield_field_submit_id($field, $item, $module);
}
return $item;
}