You are here

function key_ui_key_integration_form_submit in Key 7

Form submission handler for key_ui_key_integration_form().

File

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

Code

function key_ui_key_integration_form_submit($form, &$form_state) {
  if (!isset($form_state['values']['integrations'])) {
    return;
  }
  $fields = array();
  foreach ($form_state['values']['integrations'] as $type => $integrations) {
    foreach ($integrations as $name => $integration) {
      $fields['name'] = $name;
      if ($integration['enabled']) {
        $fields['enabled'] = 1;
      }
      else {
        $fields['enabled'] = 0;
      }
      key_save_integration_settings($fields, TRUE);
    }
  }
  drupal_set_message(t('The integration settings have been updated.'));

  //  $integrations = key_get_integrations();
  //
  //  foreach ($integrations as $key => $integration) {
  //    // If the usage was previously enabled and is now disabled.
  //    if (array_key_exists($key, $original_values) && !array_key_exists($key, $values)) {
  //      if ($disable_callback = ctools_plugin_get_function($integration, 'disable callback')) {
  //        call_user_func($disable_callback);
  //      }
  //    }
  //
  //    // If the usage was previously disabled and is now enabled.
  //    if (!array_key_exists($key, $original_values) && array_key_exists($key, $values)) {
  //      if ($enable_callback = ctools_plugin_get_function($integration, 'enable callback')) {
  //        call_user_func($enable_callback);
  //      }
  //    }
  //  }
}