public function WSCallTestForm::call in Web Service Data 8
Same name and namespace in other branches
- 2.0.x src/Form/WSCallTestForm.php \Drupal\wsdata\Form\WSCallTestForm::call()
Call the wscall.
File
- src/Form/ WSCallTestForm.php, line 83 
Class
- WSCallTestForm
- Class WSCallForm.
Namespace
Drupal\wsdata\FormCode
public function call(array $form, FormStateInterface $form_state) {
  $form_state
    ->setRebuild(TRUE);
  $form_state
    ->disableCache();
  $replacements = [];
  foreach ($this->entity
    ->getReplacements() as $replacement) {
    $replacements[$replacement] = $form_state
      ->getValue($replacement);
  }
  $response = $this->wsdata
    ->call($this->entity
    ->id(), NULL, $replacements, $form_state
    ->getValue('data'), [], $form_state
    ->getValue('returnToken'));
  $form_state
    ->setValue('wscall_response', is_array($response) ? print_r($response, TRUE) : $response);
}