You are here

function spaces_customtext_enable in Spaces 7

Same name and namespace in other branches
  1. 6.3 spaces_customtext/spaces_customtext.module \spaces_customtext_enable()
  2. 7.3 spaces_customtext/spaces_customtext.module \spaces_customtext_enable()

Implements hook_enable(). Weight spaces_customtext as the lowest possible module.

File

spaces_customtext/spaces_customtext.module, line 61
Spaces Custom Text.

Code

function spaces_customtext_enable() {
  $min = db_query("SELECT weight FROM {system} WHERE type = :type ORDER BY weight ASC LIMIT 1", array(
    ':type' => 'module',
  ))
    ->fetchField();
  $weight = $min < -10000 ? $min - 1 : -10000;
  db_update('system')
    ->fields(array(
    'weight' => $weight,
  ))
    ->condition('name', 'spaces_customtext')
    ->condition('type', 'module')
    ->execute();
}