You are here

function suggestion_enable in Autocomplete Search Suggestions 7

Implements hook_enable().

File

./suggestion.install, line 11
The installation file for the suggestion module.

Code

function suggestion_enable() {
  $min_weight = 100;
  $weight = db_query("SELECT IFNULL(MAX(weight), 0) FROM {system}")
    ->fetchField() + 1;
  $fields = array(
    'weight' => $weight >= $min_weight ? $weight : $min_weight,
  );
  db_update('system')
    ->fields($fields)
    ->condition('name', 'suggestion')
    ->execute();
}