You are here

static function clients_connection_drupal_services::connectionSettingsForm_submit in Web Service Clients 7

Same name and namespace in other branches
  1. 7.3 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services::connectionSettingsForm_submit()

Submit handler for saving/updating connections of this class.

Overrides clients_connection_base::connectionSettingsForm_submit

See also

clients_connection_form_submit().

File

backends/clients_drupal/clients_drupal.inc, line 152
Defines methods and calls to Drupal services

Class

clients_connection_drupal_services
General Drupal client class.

Code

static function connectionSettingsForm_submit($form, &$form_state) {

  // Presence of the cid tells us whether we're editing or adding a new connection.
  $new = !isset($form_state['values']['cid']);
  if ($new) {
    $form_state['values']['configuration']['password'] = clients_drupal_encrypt($form_state['values']['configuration']['password']);
  }
  else {

    // Prepare password for serialized storage
    if (empty($form_state['values']['configuration']['password'])) {

      // Need to load connection and set password to original if blank
      $original = clients_connection_load((int) $form_state['values']['cid']);
      $form_state['values']['configuration']['password'] = $original->configuration['password'];
    }
    $form_state['values']['configuration']['password'] = clients_drupal_encrypt($form_state['values']['configuration']['password']);
  }
}