function clients_connection_drupal_services_rest_7::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_submit()
File
- connections/
clients_drupal_rest/ clients_drupal_rest.inc, line 36 - Contains classes for Client connections handlers.
Class
- clients_connection_drupal_services_rest_7
- Class for Drupal client connections, REST D7.
Code
function connectionSettingsFormAlter(&$form, &$form_state) {
$form['endpoint']['#description'] = t('Remote service URL e.g. http://mysite.com/service-endpoint');
// 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_description = $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_description,
'#required' => !$password_exists,
);
}