public function WSConnectorSimpleHTTP::saveOptions in Web Service Data 8
Same name and namespace in other branches
- 2.0.x src/Plugin/WSConnector/WSConnectorSimpleHTTP.php \Drupal\wsdata\Plugin\WSConnector\WSConnectorSimpleHTTP::saveOptions()
Saves the options form.
Overrides WSConnectorBase::saveOptions
File
- src/
Plugin/ WSConnector/ WSConnectorSimpleHTTP.php, line 71
Class
- WSConnectorSimpleHTTP
- HTTP Connector.
Namespace
Drupal\wsdata\Plugin\WSConnectorCode
public function saveOptions($values) {
// Check how many key values and create the array.
$header = 0;
foreach ($values as $key => $value) {
if (preg_match("/^key_([0-9]+)/", $key, $matches)) {
if (isset($matches[1]) && !empty($values['key_' . $matches[1]])) {
$values['headers'][$header] = [
'key_' . $header => $values['key_' . $matches[1]],
'value_' . $header => $values['value_' . $matches[1]],
];
unset($values['key_' . $matches[1]]);
unset($values['value_' . $matches[1]]);
$header++;
}
}
}
return parent::saveOptions($values);
}