You are here

function clients_connection_drupal_services_7_3::connectionSettingsFormAlter in Web Service Clients 7.3

Extra form elements specific to a class's edit form.

Parameters

$form_state: The form state from the main form, which you probably don't need anyway.

Overrides clients_connection_base::connectionSettingsFormAlter

See also

clients_connection_form()

clients_connection_form_submit()

File

connections/clients_drupal/clients_drupal.inc, line 89
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

function connectionSettingsFormAlter(&$form, &$form_state) {
  $form['endpoint']['#description'] = t('Remote service URL e.g. http://mysite.com/path/to/xmlrpc');

  // There is no configuration other than the credentials.
  $form['credentials']['username'] = array(
    '#type' => 'textfield',
    '#title' => t('Service username'),
    '#size' => 30,
    '#maxlength' => 60,
    '#attributes' => array(
      'autocomplete' => 'off',
    ),
    '#description' => t('This should be same as the username on the server you are connecting to.'),
    '#required' => TRUE,
  );
  $password_exists = isset($this->credentials['password']);
  $password_desc = $password_exists ? t('This should be same as the password on the server you are connecting to. Leave blank unless you need to change this.') : t('This should be same as the password on the server you are connecting to.');
  $form['credentials']['password'] = array(
    '#type' => 'password',
    '#title' => t('Service password'),
    '#size' => 30,
    '#maxlength' => 60,
    '#attributes' => array(
      'autocomplete' => 'off',
    ),
    '#description' => $password_desc,
    '#required' => !$password_exists,
  );
}