You are here

public function AjaxController::handle in Webform CiviCRM Integration 8.5

Handles the ajax request.

Parameters

string $operation: The operation to perform: stateProvince or county

1 string reference to 'AjaxController::handle'
webform_civicrm.routing.yml in ./webform_civicrm.routing.yml
webform_civicrm.routing.yml

File

src/Controller/AjaxController.php, line 43

Class

AjaxController

Namespace

Drupal\webform_civicrm\Controller

Code

public function handle($key, $input = '', $isBilling = FALSE) {
  $this->civicrm
    ->initialize();
  if ($key === 'stateProvince') {
    $isBilling = $isBilling === 'false' ? FALSE : $isBilling;
    return $this
      ->stateProvince($input, $isBilling);
  }
  elseif ($key === 'county') {
    return $this
      ->county($input);
  }
  else {
    $processor = \Drupal::service('webform_civicrm.webform_ajax');
    return new JsonResponse($processor
      ->contactAjax($key, $input));
  }
}