You are here

static function clients_connection_drupal_services_7_3::connectionSettingsForm_submit in Web Service Clients 6.2

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

Submit handler for saving/updating connections of this class.

Overrides clients_connection_base::connectionSettingsForm_submit

See also

clients_connection_form_submit()

File

connections/clients_drupal/clients_drupal.inc, line 249
Contains classes for Client connections handlers.

Class

clients_connection_drupal_services_7_3
Drupal client for services on a Drupal 7 site for Services 7.x-3.x.

Code

static function connectionSettingsForm_submit($form, &$form_state) {
  $old_connection = $form_state['values']['old_connection'];

  // Check whether we're editing or adding a new connection.
  if ($old_connection->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'])) {

      // Set password to original if blank.
      $form_state['values']['configuration']['password'] = $old_connection->configuration['password'];
    }
    $form_state['values']['configuration']['password'] = clients_drupal_encrypt($form_state['values']['configuration']['password']);
  }
}