You are here

public function Views::submitConfigurationForm in Search API Autocomplete 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

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

Overrides PluginFormTrait::submitConfigurationForm

See also

\Drupal\Core\Plugin\PluginFormInterface::submitConfigurationForm()

File

src/Plugin/search_api_autocomplete/search/Views.php, line 125

Class

Views
Provides autocomplete support for Views search.

Namespace

Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\search

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // Filter out empty checkboxes.
  $parents = [
    'displays',
    'selected',
  ];
  $value = $form_state
    ->getValue($parents, []);
  $value = array_keys(array_filter($value));
  $form_state
    ->setValue($parents, $value);
  $this
    ->setConfiguration($form_state
    ->getValues());
}