public function JsConfigureForm::buildForm in JS Callback Handler 8.3
Form constructor.
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
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/Form/ JsConfigureForm.php, line 30 
Class
- JsConfigureForm
- Class JsConfigureForm.
Namespace
Drupal\js\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('js.settings');
  // Endpoint.
  $form['endpoint'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('JS Callback Endpoint'),
    '#description' => $this
      ->t('The endpoint used for all JS Callback requests.', [
      '@endpoint' => $form_state
        ->getValue('endpoint', $this
        ->config('js.settings')
        ->get('endpoint')),
    ]),
    '#default_value' => $form_state
      ->getValue('endpoint', $config
      ->get('endpoint')),
  ];
  // Silence PHP Errors.
  $form['silence_php_errors'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Silence PHP Errors'),
    '#description' => $this
      ->t('Prevents custom JS Callback Handler PHP error and exception handlers from being invoked.'),
    '#default_value' => $form_state
      ->getValue('silence_php_errors', $config
      ->get('silence_php_errors')),
  ];
  return parent::buildForm($form, $form_state);
}