function clients_drupal_config in Web Service Clients 6
Return value
array Form
1 string reference to 'clients_drupal_config'
- clients_drupal_menu in backends/
clients_drupal/ clients_drupal.module - Implementation of hook_menu()
File
- backends/
clients_drupal/ clients_drupal.module, line 103 - Drupal Services plugin for Clients module @author Django Beatty - adub
Code
function clients_drupal_config(&$form_state, $op, $cid = '') {
$form = array();
if ($cid) {
$connection = clients_connection_load((int) $cid);
$form['cid'] = array(
'#type' => 'value',
'#value' => $cid,
);
}
$form['type'] = array(
'#type' => 'value',
'#value' => variable_get('clients_drupal_type', 'Drupal Services'),
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Connection name'),
'#default_value' => $cid ? $connection->name : '',
'#size' => 50,
'#maxlength' => 100,
'#description' => t('Must be unique, any characters allowed'),
'#required' => TRUE,
);
$form['endpoint'] = array(
'#type' => 'textfield',
'#title' => t('Connection endpoint'),
'#default_value' => $cid ? $connection->endpoint : '',
'#size' => 50,
'#maxlength' => 100,
'#description' => t('Remote service URL e.g. http://mysite.com/services/xmlrpc'),
'#required' => TRUE,
);
$form['configuration'] = array(
'#type' => 'fieldset',
'#title' => t('Configuration'),
'#collapsible' => FALSE,
'#tree' => TRUE,
);
$form['configuration']['domain'] = array(
'#type' => 'textfield',
'#title' => t('Domain'),
'#default_value' => $cid ? $connection->configuration['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'),
'#default_value' => $cid ? $connection->configuration['servicekey'] : '',
'#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['configuration']['username'] = array(
'#type' => 'textfield',
'#title' => t('Service username'),
'#default_value' => $cid ? $connection->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 = $cid ? t('This should be same as the password on the server you are connecting to. Leave blank unless you need to change this.') : 'This should be same as the password on the server you are connecting to.';
$form['configuration']['password'] = array(
'#type' => 'password',
'#title' => t('Service password'),
'#size' => 30,
'#maxlength' => 60,
'#attributes' => array(
'autocomplete' => 'off',
),
'#description' => $password_desc,
'#required' => $op == 'add',
);
$form['configuration']['methods_enabled'] = array(
'#type' => 'textarea',
'#title' => t('Services'),
'#default_value' => $cid ? $connection->configuration['methods_enabled'] : '',
'#description' => t('List of Drupal services on remote servers that you want to enable here (e.g. views.service). Resources can select from this list. One per line.'),
);
$form['configuration']['views_enabled'] = array(
'#type' => 'textarea',
'#title' => t('Views'),
'#default_value' => $cid ? $connection->configuration['views_enabled'] : '',
'#description' => t('List of Drupal views on remote servers. Resources can select from this list. One per line.'),
);
if ($op == 'add') {
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add connection'),
);
$form['#submit'] = array(
'clients_drupal_add_submit_handler',
);
}
elseif ($op == 'edit') {
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['#submit'] = array(
'clients_drupal_edit_submit_handler',
);
}
return $form;
}