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

Submit handler for field_ui_view_mode_form().

File

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

Code

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

  $view_mode = array(
    'label' => $form_state['values']['label'],
    'machine_name' => $view_mode_name,
    'is_new' => $form['#new'],
  );

  // Save the new display mode.
  entity_view_mode_save($entity_type, $view_mode);

  if ($form['#new']) {
    field_ui_view_mode_enable($entity_type, $bundle, $view_mode_name, FALSE);
  }
  else {
    backdrop_set_message(t('Saved the %view-mode display mode.', array(
      '%view-mode' => $view_mode['label']
    )));
  }

  $form_state['redirect'] = $path;
}