You are here

public static function KeyEntityFormEnhancer::testConnectionAjaxCallback in Apigee Edge 8

Ajax callback for test connection.

Parameters

array $form: Form render array.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

Return value

array Render array.

File

src/KeyEntityFormEnhancer.php, line 430

Class

KeyEntityFormEnhancer
Enhances Apigee Edge related Key entity add/edit forms.

Namespace

Drupal\apigee_edge

Code

public static function testConnectionAjaxCallback(array $form, FormStateInterface $form_state) : array {

  // Capture and re-render all messages as part of the form so when AJAX
  // rebuilds the form all previous messages get removed from the UI.
  $original_weight = $form['settings']['messages']['#weight'] ?? 0;
  $form['settings']['messages'] = StatusMessages::renderMessages();
  $form['settings']['messages']['#weight'] = $original_weight;
  return $form;
}