You are here

function custom_search_search_page_submit in Custom Search 8

Search pages settings form callback.

1 string reference to 'custom_search_search_page_submit'
custom_search_form_alter in ./custom_search.module
Implements hook_form_alter().

File

./custom_search.module, line 355
Bring customizations to the default search box.

Code

function custom_search_search_page_submit($form, FormStateInterface $form_state) {
  $pageId = $form_state
    ->getValue('id');

  // Save settings, and path as well so we can use it to retrieve the correct
  // settings later.
  \Drupal::configFactory()
    ->getEditable('custom_search.settings.results')
    ->set($pageId . '.path', $form_state
    ->getValue('path'))
    ->set($pageId . '.search', $form_state
    ->getValue('custom_search_search'))
    ->set($pageId . '.advanced.visibility', $form_state
    ->getValue('custom_search_advanced_search'))
    ->set($pageId . '.advanced.collapsible', $form_state
    ->getValue('custom_search_collapsible'))
    ->set($pageId . '.advanced.collapsed', $form_state
    ->getValue('custom_search_collapsed'))
    ->set($pageId . '.advanced.criteria', $form_state
    ->getValue('custom_search_criteria'))
    ->set($pageId . '.advanced.types', $form_state
    ->getValue('custom_search_types'))
    ->set($pageId . '.advanced.languages', $form_state
    ->getValue('custom_search_languages'))
    ->set($pageId . '.info', $form_state
    ->getValue('custom_search_info'))
    ->set($pageId . '.filter.position', $form_state
    ->getValue('custom_search_filter_position'))
    ->set($pageId . '.filter.label', $form_state
    ->getValue('custom_search_filter_label'))
    ->set($pageId . '.filter.any', $form_state
    ->getValue('custom_search_filter_any'))
    ->save();
}