You are here

function audiofield_form_content_field_overview_submit in AudioField 7

Submit handler to set a new field's formatter to "audiofield_embedded".

1 string reference to 'audiofield_form_content_field_overview_submit'
audiofield_form_field_ui_field_settings_form_alter in ./audiofield.module
Implements hook_form_FORM_ID_alter().

File

./audiofield.module, line 356
Audio Field module for displaying audio files as usable players.

Code

function audiofield_form_content_field_overview_submit(&$form, &$form_state) {
  $entity_type = 'node';
  $field_name = $form_state['values']['field']['field_name'];
  $bundle = $form_state['complete form']['#bundle'];
  $instance = field_read_instance($entity_type, $field_name, $bundle);
  if ($instance['widget']['module'] == 'audiofield') {
    foreach ($instance['display'] as $display_type => $display_settings) {
      if ($instance['display'][$display_type]['type'] == 'file_default') {
        $instance['display'][$display_type]['type'] = 'audiofield_embedded';
      }
    }
    field_update_instance($instance);
  }
}