public function WSConnectorSOAP::getOptionsForm in Web Service Data 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/WSConnector/WSConnectorSOAP.php \Drupal\wsdata\Plugin\WSConnector\WSConnectorSOAP::getOptionsForm()
Return the settings form provided by the connector.
Overrides WSConnectorSimpleHTTP::getOptionsForm
File
- src/
Plugin/ WSConnector/ WSConnectorSOAP.php, line 54
Class
- WSConnectorSOAP
- REST Connector.
Namespace
Drupal\wsdata\Plugin\WSConnectorCode
public function getOptionsForm($options = []) {
$form['path'] = [
'#title' => $this
->t('Path'),
'#description' => $this
->t('The final endpoint will be <em>Server Endpoint/Path</em>'),
'#type' => 'textfield',
'#maxlength' => 512,
];
$form['user'] = [
'#type' => 'textfield',
'#title' => $this
->t('Username'),
'#description' => $this
->t('Authentication'),
'#required' => true,
];
$form['key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Password'),
'#description' => $this
->t('Authentication'),
'#required' => true,
];
$header_count = 5;
if (isset($options['form_state'])) {
$input = $options['form_state']
->getUserInput();
if (isset($input['headers_count'])) {
$header_count = $input['headers_count'] + 1;
}
}
$form['headers'] = [
'#title' => $this
->t('Fixed Parameters'),
'#type' => 'fieldset',
'#attributes' => [
'id' => 'wsconnector-headers',
],
];
$form['headers']['headers_count'] = [
'#type' => 'hidden',
'#value' => $header_count,
];
for ($i = 0; $i < $header_count; $i++) {
$form['headers'][$i]['key_' . $i] = [
'#type' => 'textfield',
'#title' => t('Key'),
];
$form['headers'][$i]['value_' . $i] = [
'#type' => 'textfield',
'#title' => t('Value'),
];
}
if (isset($options['form_state'])) {
$form['headers']['add_another'] = [
'#type' => 'submit',
'#value' => $this
->t('Add another'),
'#ajax' => [
'callback' => '\\Drupal\\wsdata\\Plugin\\WSConnector\\WSConnectorSimpleHTTP::wsconnectorHttpHeaderAjaxCallback',
'wrapper' => 'wsconnector-headers',
],
'#limit_validation_errors' => [],
];
}
$form['wsdl'] = [
'#type' => 'textfield',
'#title' => $this
->t('WSDL'),
'#description' => $this
->t('WSDL url'),
'#required' => true,
];
$form['method'] = [
'#type' => 'textfield',
'#title' => $this
->t('Method'),
'#description' => $this
->t('Method name'),
'#required' => true,
];
return $form;
}