You are here

function key_ui_key_config_form_submit in Key 7

Form submission handler for key_ui_key_config_form().

1 string reference to 'key_ui_key_config_form_submit'
key_ui_key_config_form in modules/key_ui/includes/key_ui.admin.inc
Form constructor for the key configuration edit form.

File

modules/key_ui/includes/key_ui.admin.inc, line 237
Administrative functionality for managing key configurations.

Code

function key_ui_key_config_form_submit($form, &$form_state) {
  $provider = key_get_provider($form_state['values']['provider']);
  foreach (array(
    $provider,
  ) as $plugin) {
    if ($submit_callback = ctools_plugin_get_function($plugin, 'submit callback')) {

      // Create a copy so that the plugin callback cannot change the
      // form state.
      $form_state_copy = $form_state;
      call_user_func($submit_callback, $form, $form_state_copy);
    }
  }
  $fields = array(
    'name' => (string) $form_state['values']['name'],
    'label' => (string) $form_state['values']['label'],
    'description' => (string) $form_state['values']['description'],
    'type' => (string) $form_state['values']['type'],
    'provider' => (string) $form_state['values']['provider'],
    'provider_settings' => serialize($form_state['values']['provider_settings']),
    'created' => (string) $form_state['values']['created'],
  );
  $key = isset($form_state['values']['key']) ? $form_state['values']['key'] : NULL;
  key_save_config($fields, $key);
  $form_state['redirect'] = KEY_MENU_PATH . '/list';
}