You are here

public function AppSettingsForm::apiProductListCallback in Apigee Edge 8

Ajax callback for the "user_select" checkbox.

Set 'default_api_product_multiple' checkboxes form element as required if the 'user_select' is unchecked, else not required. Use AJAX instead of #states because #required in #states is not working properly.

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 The Ajax response.

See also

https://www.drupal.org/project/drupal/issues/2855139

File

src/Form/AppSettingsForm.php, line 197

Class

AppSettingsForm
Configuration form builder for general app settings.

Namespace

Drupal\apigee_edge\Form

Code

public function apiProductListCallback(array &$form, FormStateInterface $form_state) : AjaxResponse {
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand('#default-api-product-multiple', $this->renderer
    ->render($form['api_product']['default_api_product_multiple_container'])));
  return $response;
}