function asset_embed_asset_formatter in Asset 6
Same name and namespace in other branches
- 5 asset_embed/asset_embed.module \asset_embed_asset_formatter()
File
- asset_embed/
asset_embed.module, line 149 - Asset Embed Module
Code
function asset_embed_asset_formatter($op = 'info', $asset = null, $attr = array()) {
$providers = asset_embed_list_providers();
switch ($op) {
case 'info':
$formats['fullsize'] = array(
'name' => 'Full-Size Embed',
'types' => array(
'embed' => array(
'*',
),
),
'description' => t('Display the full-size version of the embedded content.'),
);
$formats['thumbnail'] = array(
'name' => 'Thumbnail Embed',
'types' => array(
'embed' => array(
'*',
),
),
'description' => t('Display a thumbnail preview image of the embedded content.'),
);
return $formats;
case 'init':
break;
case 'options':
switch ($attr['format']) {
case 'thumbnail':
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#size' => '10',
'#default_value' => '120',
);
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#size' => '10',
'#default_value' => '160',
);
break;
case 'fullsize':
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#size' => '10',
'#default_value' => '335',
);
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#size' => '10',
'#default_value' => '425',
);
break;
}
$form = array_merge($form, (array) asset_embed_invoke($asset->embed['provider'], 'formatter_options', $asset, $attr['format']));
return $form;
case 'preview':
if (function_exists('theme_asset_embed_' . $asset->embed['provider'] . '_thumbnail')) {
return theme('asset_embed_' . $asset->embed['provider'] . '_thumbnail', $asset);
}
return theme('asset_embed_thumbnail', $asset);
case 'img':
return asset_embed_invoke($asset->embed['provider'], 'thumbnail_src', $asset, $attr);
break;
case 'details':
break;
case 'render':
switch ($attr['format']) {
case 'thumbnail':
if (function_exists('theme_asset_embed_' . $asset->embed['provider'] . '_thumbnail')) {
return theme('asset_embed_' . $asset->embed['provider'] . '_thumbnail', $asset);
}
return theme('asset_embed_thumbnail', $asset);
break;
case 'fullsize':
default:
if (function_exists('theme_asset_embed_' . $asset->embed['provider'] . '_fullsize')) {
return theme('asset_embed_' . $asset->embed['provider'] . '_fullsize', $asset, $attr);
}
return theme('asset_embed_fullsize', $asset, $attr);
}
break;
}
}