function asset_emfield_invoke in Asset 6
Same name and namespace in other branches
- 5.2 contrib/asset_emfield/asset_emfield.module \asset_emfield_invoke()
helper function to bridge hook_asset_type and emfield cck hooks
4 calls to asset_emfield_invoke()
- asset_emfield_asset_formatter in contrib/
asset_emfield/ asset_emfield.module - Implementation of hook_asset_formatter().
- asset_emfield_asset_type in contrib/
asset_emfield/ asset_emfield.module - Implementation of hook_asset_type().
- video_cck_google_asset_search in contrib/
asset_emfield/ providers/ google.inc - Implementation of hook_provider_asset_search().
- video_cck_youtube_asset_search in contrib/
asset_emfield/ providers/ youtube.inc - Implementation of hook_provider_asset_search().
File
- contrib/
asset_emfield/ asset_emfield.module, line 127 - Asset Embedded Media Module
Code
function asset_emfield_invoke($op, &$asset, $a3 = NULL) {
// TODO: use widget settings to provide a dynamic widget object
$field = array(
'field_name' => 'emfield',
'type' => $map[$asset->type],
'required' => 1,
'multiple' => 0,
'db_storage' => 1,
// ????
'widget' => array(
'default_value' => array(
0 => array(
'embed' => '',
'value' => '',
),
),
'providers' => array(),
'type' => 'video_cck_textfields',
'label' => t('Embedded Media'),
'description' => '',
),
);
$module_map = array(
'emfield_video' => 'video_cck',
);
$module = $module_map[$asset->type];
$node = new stdClass();
// emfield_emfield_field_formatter checks for a node type, and if not will load
// the field widget settings. the type doesn't really matter though.
$node->type = '__asset';
if ($op == 'form') {
return emfield_emfield_widget($op, $node, $field, $asset->emfield, $module);
}
elseif ($op == 'render') {
return module_invoke('emfield', 'emfield_field_formatter', $field, $asset->emfield[0], $a3, $node, $module);
}
else {
return emfield_emfield_field($op, $node, $field, $asset->emfield, 0, 0, $module);
}
}