You are here

function suggestion_admin_edit_form_submit in Autocomplete Search Suggestions 7

Custom submit function for the suggestion setting form.

1 string reference to 'suggestion_admin_edit_form_submit'
suggestion_admin_edit_form in ./suggestion.admin.inc
Menu callback to index suggestions.

File

./suggestion.admin.inc, line 70
Administration form for suggestion module.

Code

function suggestion_admin_edit_form_submit($form, &$state) {
  $src = 0;
  foreach ((array) $state['values']['src'] as $bit) {
    $src |= intval($bit);
  }
  $key = array(
    'ngram' => $state['values']['ngram'],
  );
  $fields = array(
    'atoms' => $state['values']['atoms'],
    'density' => SuggestionHelper::calculateDensity($src, $state['values']['atoms'], $state['values']['qty']),
    'qty' => $state['values']['qty'],
    'src' => $src,
  );
  SuggestionStorage::mergeSuggestion($key, $fields);
}