You are here

function file_entity_file_display_form_submit in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7 file_entity.admin.inc \file_entity_file_display_form_submit()
  2. 7.2 file_entity.admin.inc \file_entity_file_display_form_submit()

Process file display settings form submissions.

File

./file_entity.admin.inc, line 783

Code

function file_entity_file_display_form_submit($form, &$form_state) {
  $file_type = $form['#file_type'];
  $view_mode = $form['#view_mode'];
  $displays = isset($form_state['values']['displays']) ? $form_state['values']['displays'] : array();
  $displays_original = file_displays_load($file_type, $view_mode, TRUE);
  foreach ($displays as $formatter_name => $display) {
    $display_original = isset($displays_original[$formatter_name]) ? $displays_original[$formatter_name] : file_display_new($file_type, $view_mode, $formatter_name);
    $display += (array) $display_original;
    file_display_save((object) $display);
  }
  drupal_set_message(t('Your settings have been saved.'));
}