You are here

function media_field_formatter_settings_form in D7 Media 7

Same name and namespace in other branches
  1. 7.4 includes/media.fields.inc \media_field_formatter_settings_form()
  2. 7.2 includes/media.fields.inc \media_field_formatter_settings_form()
  3. 7.3 includes/media.fields.inc \media_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

includes/media.fields.inc, line 104
: Provides a "Multimedia asset" field to the fields API

Code

function media_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;
}