You are here

public static function SmartIpAdminSettingsForm::manualLookupAjax in Smart IP 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/SmartIpAdminSettingsForm.php \Drupal\smart_ip\Form\SmartIpAdminSettingsForm::manualLookupAjax()
  2. 8.2 src/Form/SmartIpAdminSettingsForm.php \Drupal\smart_ip\Form\SmartIpAdminSettingsForm::manualLookupAjax()

Submit handler to lookup an IP address in the database.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\Core\Ajax\AjaxResponse An AJAX response representing the form and its AJAX commands.

See also

\Drupal\smart_ip\Form\SmartIpAdminSettingsForm::manualLookup

File

src/Form/SmartIpAdminSettingsForm.php, line 421
Contains \Drupal\smart_ip\Form\SmartIpAdminSettingsForm.

Class

SmartIpAdminSettingsForm
Smart IP main admin settings page.

Namespace

Drupal\smart_ip\Form

Code

public static function manualLookupAjax(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $storage = $form_state
    ->getStorage();
  $value = isset($storage['smart_ip_message']) ? $storage['smart_ip_message'] : '';
  $response
    ->addCommand(new HtmlCommand('#smart-ip-location-manual-lookup', $value));
  return $response;
}