You are here

function suggestion_admin_edit_form in Autocomplete Search Suggestions 7

Menu callback to index suggestions.

1 string reference to 'suggestion_admin_edit_form'
suggestion_menu in ./suggestion.module
Implements hook_menu().

File

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

Code

function suggestion_admin_edit_form($form, &$state, $ngram) {
  $obj = SuggestionStorage::getSuggestion($ngram);
  $form['#submit'][] = 'suggestion_admin_edit_form_submit';
  $form['#validate'][] = 'suggestion_admin_edit_form_validate';
  $form['ngram'] = array(
    '#type' => 'value',
    '#value' => $obj->ngram,
  );
  $form['atoms'] = array(
    '#type' => 'value',
    '#value' => $obj->atoms,
  );
  $form['density'] = array(
    '#type' => 'value',
    '#value' => $obj->density,
  );
  $form['ngram_txt'] = array(
    '#markup' => t('Suggestion: @ngram', array(
      '@ngram' => $obj->ngram,
    )),
    '#suffix' => '<br />',
    '#weight' => 10,
  );
  $form['atoms_txt'] = array(
    '#markup' => t('Words: @atoms', array(
      '@atoms' => $obj->atoms,
    )),
    '#suffix' => '<br />',
    '#weight' => 20,
  );
  $form['density_txt'] = array(
    '#markup' => t('Score: @density', array(
      '@density' => $obj->density,
    )),
    '#weight' => 30,
  );
  $form['qty'] = array(
    '#title' => t('Quantity'),
    '#type' => 'textfield',
    '#default_value' => $obj->qty,
    '#required' => TRUE,
    '#weight' => 40,
  );
  $form['src'] = array(
    '#title' => t('Source'),
    '#type' => 'select',
    '#options' => SuggestionStorage::getSrcOptions(),
    '#default_value' => SuggestionHelper::srcBits($obj->src),
    '#multiple' => TRUE,
    '#required' => TRUE,
    '#weight' => 50,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#weight' => 100,
  );
  return $form;
}