function videojs_field_formatter_settings_form in Video.js (HTML5 Video Player) 7.2
Same name and namespace in other branches
- 7.3 videojs.module \videojs_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
videojs.module, line 148 - Provides an HTML5-compatible with Flash-fallback video player.
Code
function videojs_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);
if (isset($instance['entity_type']) && isset($instance['bundle'])) {
$imagefields = _videojs_find_image_fields($field, $instance['entity_type'], $instance['bundle']);
}
$form = array(
'#element_validate' => array(
'videojs_field_formatter_settings_form_validate',
),
);
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $settings['width'],
'#size' => 6,
'#maxlength' => 5,
'#element_validate' => array(
'element_validate_integer_positive',
),
);
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => $settings['height'],
'#size' => 6,
'#maxlength' => 5,
'#element_validate' => array(
'element_validate_integer_positive',
),
);
if (!empty($imagefields)) {
$form['posterimage_field'] = array(
'#type' => 'select',
'#title' => t('Poster image field'),
'#default_value' => $settings['posterimage_field'],
'#options' => $imagefields,
'#description' => t('If an image is uploaded to the field above it will be used as the poster image.'),
'#empty_value' => NULL,
'#empty_option' => t('- None -'),
);
$form['posterimage_style'] = array(
'#title' => t('Poster image style'),
'#type' => 'select',
'#default_value' => $settings['posterimage_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,
);
}
return $form;
}