1 field_ui.admin.inc field_ui_view_mode_reset_form_submit($form, &$form_state)

Submit handler for field_ui_view_mode_reset_form().

File

core/modules/field_ui/field_ui.admin.inc, line 2477
Administrative interface for custom field type creation.

Code

function field_ui_view_mode_reset_form_submit($form, &$form_state) {
  $entity_type = $form['#entity_type'];
  $bundle = $form['#bundle'];
  $view_mode_name = $form['#machine_name'];

  // Save updated bundle settings.
  $bundle_settings = field_bundle_settings($entity_type, $bundle);
  $bundle_settings['view_modes'][$view_mode_name]['custom_settings'] = FALSE;
  field_bundle_settings($entity_type, $bundle, $bundle_settings);

  $path = _field_ui_bundle_admin_path($entity_type, $bundle) . '/display';

  // Set a friendly message.
  $entity_info = entity_get_info($entity_type);
  $label = $entity_info['view modes'][$view_mode_name]['label'];
  $message = t('The display mode %name will now use the <em>Default</em> settings.', array('%name' => $label));
  backdrop_set_message($message);

  // Reload the current page.
  $form_state['redirect'] = $path;
}