You are here

public function FacSettingsForm::buildForm in Fast Autocomplete 8

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/FacSettingsForm.php, line 32

Class

FacSettingsForm
Configure Fast Autocomplete general settings.

Namespace

Drupal\fac\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('fac.settings');
  $form['key_interval'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Key update interval'),
    '#default_value' => $config
      ->get('key_interval'),
    '#description' => $this
      ->t('To reduce the risk of information leakage a role-based hash/key is used in the json files URL. Enter the key update interval in seconds (defaults to one week).'),
  ];
  $form['highlighting_script_use_cdn'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Use a CDN to load the highlighting script'),
    '#default_value' => $config
      ->get('highlighting_script_use_cdn'),
    '#description' => $this
      ->t('Disable this option to use a local version of the mark.js script. <a href="@url">Download the script</a> and save it in the /libraries/mark.js/ folder in your codebase.', [
      '@url' => 'https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js',
    ]),
  ];
  return parent::buildForm($form, $form_state);
}