function video_field_formatter_settings_form in Video 7.2
Same name and namespace in other branches
- 7 video.field.inc \video_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
video.field.inc, line 1025 - Implement a video field, based on the file module's file field.
Code
function video_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$image_styles = image_style_options(FALSE);
switch ($display['type']) {
case 'video_formatter_thumbnail':
$element['image_style'] = array(
'#title' => t('Video thumbnail style'),
'#type' => 'select',
'#default_value' => $settings['image_style'],
'#empty_option' => t('None (original video thumbnail)'),
'#options' => $image_styles,
);
$element['image_link'] = array(
'#title' => t('Link video or video thumbnail to'),
'#type' => 'select',
'#default_value' => $settings['image_link'],
'#empty_option' => t('Nothing'),
'#options' => array(
'content' => t('Content'),
'file' => t('File'),
),
);
if (module_exists('colorbox')) {
$element['image_link']['#options']['colorbox'] = t('Colorbox');
$element['widthxheight'] = array(
'#title' => t('Video Player Dimensions'),
'#type' => 'select',
'#default_value' => $settings['widthxheight'],
'#description' => t('Select the desired dimensions of the video player. You can add your own dimensions at !settings.', array(
'!settings' => l(t('video module settings'), 'admin/config/media/video'),
)),
'#options' => video_utility::getDimensions(),
'#states' => array(
'visible' => array(
'input[name="options[settings][image_link]"]' => array(
'value' => 'colorbox',
),
),
),
);
}
break;
case 'video_formatter_player':
$element['widthxheight'] = array(
'#title' => t('Dimensions'),
'#type' => 'select',
'#default_value' => $settings['widthxheight'],
'#description' => t('Select the desired dimensions of the video player. You can add your own dimensions at !settings.', array(
'!settings' => l(t('video module settings'), 'admin/config/media/video'),
)),
'#options' => video_utility::getDimensions(),
);
$element['poster_image_style'] = array(
'#title' => t('Poster image style'),
'#type' => 'select',
'#default_value' => $settings['poster_image_style'],
'#empty_option' => t('None (original image)'),
'#description' => t('The original video thumbnail will be displayed. Otherwise, you can add a custom image style at !settings.', array(
'!settings' => l(t('media image styles'), 'admin/config/media/image-styles'),
)),
'#options' => $image_styles,
);
break;
case 'video_formatter_url':
// Get the transcoder presets
$presets = variable_get('video_preset');
$preset_extensions = array(
'original' => t('Original video format'),
);
foreach ($presets as $preset) {
$preset_settings = video_get_preset($preset);
$preset_extensions[$preset_settings['settings']['video_extension']] = $preset_settings['settings']['video_extension'];
}
$element['video_extension'] = array(
'#title' => t('Video format'),
'#type' => 'select',
'#default_value' => $settings['video_extension'],
'#options' => $preset_extensions,
);
$element['link_title'] = array(
'#title' => t('Link title'),
'#type' => 'textfield',
'#default_value' => $settings['link_title'],
'#description' => t('Leave this blank to use the url to the file'),
);
break;
}
return $element;
}