You are here

function clients_connection_drupal_services_7_3::connectionSettingsForm 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()

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 ;)

Parameters

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

Return value

A FormAPI form array. This will be merged in with basic data and the submit button added.

Overrides clients_connection_base::connectionSettingsForm

See also

clients_connection_form()

clients_connection_form_submit()

File

connections/clients_drupal/clients_drupal.inc, line 197
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 connectionSettingsForm(&$form_state) {
  $form = array();
  $form['endpoint'] = array(
    '#type' => 'textfield',
    '#title' => t('Connection endpoint'),
    '#default_value' => $this->new ? '' : $this->endpoint,
    '#size' => 50,
    '#maxlength' => 100,
    '#description' => t('Remote service URL e.g. http://mysite.com/path/to/xmlrpc'),
    '#required' => TRUE,
  );
  $form['configuration'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configuration'),
    '#collapsible' => FALSE,
    '#tree' => TRUE,
  );
  $form['configuration']['username'] = array(
    '#type' => 'textfield',
    '#title' => t('Service username'),
    '#default_value' => $this->new ? '' : $this->configuration['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_desc = $this->new ? t('This should be same as the password on the server you are connecting to.') : t('This should be same as the password on the server you are connecting to. Leave blank unless you need to change this.');
  $form['configuration']['password'] = array(
    '#type' => 'password',
    '#title' => t('Service password'),
    '#size' => 30,
    '#maxlength' => 60,
    '#attributes' => array(
      'autocomplete' => 'off',
    ),
    '#description' => $password_desc,
    '#required' => $this->new,
  );
  return $form;
}