You are here

function pathauto_install in Pathauto 7

Same name and namespace in other branches
  1. 8 pathauto.install \pathauto_install()
  2. 5.2 pathauto.install \pathauto_install()
  3. 6.2 pathauto.install \pathauto_install()
  4. 6 pathauto.install \pathauto_install()

Implements hook_install().

File

./pathauto.install, line 47
Install, update, and uninstall functions for Pathauto.

Code

function pathauto_install() {

  // Set some default variables necessary for the module to perform.
  $defaults = array(
    'pathauto_node_pattern' => 'content/[node:title]',
    'pathauto_taxonomy_term_pattern' => '[term:vocabulary]/[term:name]',
    'pathauto_forum_pattern' => '[term:vocabulary]/[term:name]',
    'pathauto_user_pattern' => 'users/[user:name]',
    'pathauto_blog_pattern' => 'blogs/[user:name]',
    // Set hyphen character to replace instead of remove.
    'pathauto_punctuation_hyphen' => 1,
  );
  foreach ($defaults as $variable => $default) {
    if (variable_get($variable) === NULL) {
      variable_set($variable, $default);
    }
  }

  // Set the weight to 1
  db_update('system')
    ->fields(array(
    'weight' => 1,
  ))
    ->condition('type', 'module')
    ->condition('name', 'pathauto')
    ->execute();
}