You are here

function mediafield_field_formatter_settings_form in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 modules/mediafield/mediafield.module \mediafield_field_formatter_settings_form()
  2. 7.2 modules/mediafield/mediafield.module \mediafield_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

modules/mediafield/mediafield.module, line 85
Provide a "Multimedia asset" field.

Code

function mediafield_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  if ($display['type'] == 'media') {
    $entity_info = entity_get_info('file');
    $options = array(
      'default' => t('Default'),
    );
    foreach ($entity_info['view modes'] as $file_view_mode => $file_view_mode_info) {
      $options[$file_view_mode] = $file_view_mode_info['label'];
    }
    $element['file_view_mode'] = array(
      '#title' => t('File view mode'),
      '#type' => 'select',
      '#default_value' => $settings['file_view_mode'],
      '#options' => $options,
    );
  }
  return $element;
}