You are here

public function Search::submitConfigurationForm in Google Site Search 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 form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::submitConfigurationForm

File

src/Plugin/Search/Search.php, line 274

Class

Search
Handles search using Google Search Engine.

Namespace

Drupal\gss\Plugin\Search

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $keys = [];
  $languages = $this
    ->getSupportedLanguages();
  foreach ($languages as $language) {
    $keys[] = 'search_engine_id_' . $language
      ->getId();
  }
  $defaults = [
    'api_key',
    'base_url',
    // @todo autocomplete
    // 'autocomplete',
    'page_size',
    'pager_size',
    'images',
    'labels',
  ];
  $keys = array_merge($keys, $defaults);
  foreach ($keys as $key) {
    $this->configuration[$key] = $form_state
      ->getValue($key);
  }
}