You are here

function video_embed_field_field_formatter_settings_form in Video Embed Field 7.2

Implements hook_field_formatter_settings_form().

File

./video_embed_field.field.inc, line 334
Implement a video field.

Code

function video_embed_field_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  if ($display['type'] == 'video_embed_field' || $display['type'] == 'video_embed_field_thumbnail_colorbox' || $display['type'] == 'video_embed_field_url_colorbox') {
    $video_styles = video_embed_field_video_style_options(FALSE);
    $element['video_style'] = array(
      '#title' => t('Video style'),
      '#type' => 'select',
      '#default_value' => $settings['video_style'],
      '#options' => $video_styles,
    );
  }
  if ($display['type'] == 'video_embed_field_thumbnail' || $display['type'] == 'video_embed_field_thumbnail_colorbox') {
    $element['image_style'] = array(
      '#title' => t('Image style'),
      '#type' => 'select',
      '#options' => image_style_options(FALSE),
      '#default_value' => $settings['image_style'],
      '#empty_option' => t('None (original image)'),
    );
  }
  if ($display['type'] == 'video_embed_field_thumbnail') {
    $link_types = array(
      'content' => t('Content'),
      'source' => t('Video Source'),
    );
    $element['image_link'] = array(
      '#title' => t('Link thumbnail to'),
      '#type' => 'select',
      '#default_value' => $settings['image_link'],
      '#empty_option' => t('Nothing'),
      '#options' => $link_types,
    );
  }
  if ($instance['settings']['description_field'] && $display['type'] != 'video_embed_field_url' && $display['type'] != 'video_embed_field_url_colorbox') {
    $element['description'] = array(
      '#title' => t('Show description'),
      '#type' => 'checkbox',
      '#default_value' => $settings['description'],
    );
    $element['description_position'] = array(
      '#title' => t('Description Position'),
      '#type' => 'select',
      '#options' => array(
        'top' => t('Top'),
        'bottom' => t('Bottom'),
      ),
      '#default_value' => $settings['description_position'],
      '#states' => array(
        'visible' => array(
          ':input[name="fields[' . $field['field_name'] . '][settings_edit_form][settings][description]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
  }
  return $element;
}