You are here

function mediaelement_field_formatter_settings_form in MediaElement 7

Same name and namespace in other branches
  1. 7.2 mediaelement.module \mediaelement_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

./mediaelement.field.inc, line 72
Field integration for the MediaElement module.

Code

function mediaelement_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  $element['features'] = array(
    '#title' => t('Features'),
    '#description' => t('Controls on the control bar.'),
    '#type' => 'fieldset',
  );
  $element['features']['playpause'] = array(
    '#title' => t('Play/pause button'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['playpause'],
  );
  $element['features']['current'] = array(
    '#title' => t('Current time'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['current'],
  );
  $element['features']['progress'] = array(
    '#title' => t('Progress'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['progress'],
  );
  $element['features']['duration'] = array(
    '#title' => t('Duration'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['duration'],
  );
  $element['features']['tracks'] = array(
    '#title' => t('Tracks'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['tracks'],
  );
  $element['features']['volume'] = array(
    '#title' => t('Volume'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['volume'],
  );
  $element['features']['fullscreen'] = array(
    '#title' => t('Fullscreen'),
    '#type' => 'checkbox',
    '#default_value' => $settings['features']['fullscreen'],
  );
  $element['volume'] = array(
    '#title' => t('Initial volume'),
    '#type' => 'textfield',
    '#description' => t("Number between 0 and 1."),
    '#default_value' => $settings['volume'],
  );
  $element['controls'] = array(
    '#title' => t('Controls'),
    '#type' => 'checkbox',
    '#default_value' => $settings['controls'],
  );
  $element['show_description'] = array(
    '#title' => t('Show description'),
    '#type' => 'select',
    '#options' => array(
      'none' => t('Do not display'),
      'above' => t('Above element'),
      'below' => t('Below element'),
    ),
    '#default_value' => $settings['show_description'],
  );
  $element['width'] = array(
    '#title' => t('Width'),
    '#type' => 'textfield',
    '#description' => t('Specify width unit using px or %. Valid examples (enter without quotes): "100%" or "345px"'),
    '#default_value' => $settings['width'],
  );
  $element['height'] = array(
    '#title' => t('Height'),
    '#type' => 'textfield',
    '#description' => t('Specify height unit using px or %. Valid examples (enter without quotes): "100%" or "345px"'),
    '#default_value' => $settings['height'],
  );
  $element['autoplay'] = array(
    '#title' => t('Autoplay'),
    '#type' => 'checkbox',
    '#default_value' => $settings['autoplay'],
  );
  $element['loop'] = array(
    '#title' => t('Loop'),
    '#type' => 'checkbox',
    '#default_value' => $settings['loop'],
  );
  $element['download_link'] = array(
    '#title' => t('Download Link'),
    '#type' => 'checkbox',
    '#default_value' => $settings['download_link'],
  );
  $element['download_text'] = array(
    '#title' => t('Download Link Text'),
    '#type' => 'textfield',
    '#default_value' => $settings['download_text'],
  );
  $element['preload'] = array(
    '#title' => t('Preload'),
    '#description' => t('Provide a hint to the user agent about whether it should pre-load the media resource.'),
    '#type' => 'radios',
    '#options' => array(
      'none' => t('None: Do not preload the resource.'),
      'metadata' => t('Metadata: Load only the resource metadata (dimensions, first frame, track list, duration, etc). May cause full preload.'),
      'auto' => t('Automatic: Preload is possible.'),
    ),
    '#default_value' => $settings['preload'],
  );
  return $element;
}