function clients_connection_drupal_services_6_2::connectionSettingsFormAlter in Web Service Clients 7.3
Extra form elements specific to a class's edit form.
This is the same pattern as node_form() -- just ignore the object behind the curtain ;)
This is common to versions 6-2 and 5 of Drupal Services.
Overrides clients_connection_base::connectionSettingsFormAlter
See also
clients_connection_form_submit()
File
- connections/
clients_drupal/ clients_drupal.inc, line 264 - Contains classes for Client connections handlers.
Class
- clients_connection_drupal_services_6_2
- Drupal client for services on a Drupal 6 site for Services 6.x-2.x.
Code
function connectionSettingsFormAlter(&$form, &$form_state) {
$form['endpoint']['#description'] = t('Remote service URL e.g. http://mysite.com/path/to/xmlrpc');
$form['configuration'] += array(
'#type' => 'fieldset',
'#title' => t('Configuration'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
$form['configuration']['domain'] = array(
'#type' => 'textfield',
'#title' => t('Domain'),
'#size' => 50,
'#maxlength' => 100,
'#description' => t('This should be same as the \'Domain\' field used by the Services authentication key on the server you are connecting to.'),
'#required' => TRUE,
);
$form['configuration']['servicekey'] = array(
'#type' => 'textfield',
'#title' => t('Service key'),
'#size' => 50,
'#maxlength' => 40,
'#attributes' => array(
'autocomplete' => 'off',
),
'#description' => t('This should be same as the \'Key\' field used by the Services authentication key on the server you are connecting to.'),
'#required' => TRUE,
);
$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,
);
return $form;
}