You are here

views_url_alias_node.install in Views URL alias 6

Same filename and directory in other branches
  1. 8 views_url_alias_node.install
  2. 7 views_url_alias_node.install

Installation information for the Views URL alias (node) module.

File

views_url_alias_node.install
View source
<?php

/**
 * @file
 * Installation information for the Views URL alias (node) module.
 */

/**
 * Implementation of hook_enable().
 */
function views_url_alias_node_enable() {
  views_url_alias_node_rebuild();
}

/**
 * Implementation of hook_install().
 */
function views_url_alias_node_install() {

  // Set the weight to 2 so that this module executes after pathauto.
  db_query("UPDATE {system} SET weight = 2 WHERE name = 'views_url_alias_node'");

  // Install tables
  drupal_install_schema('views_url_alias_node');
}

/**
 * Implementation of hook_uninstall().
 */
function views_url_alias_node_uninstall() {

  // Uninstall tables
  drupal_uninstall_schema('views_url_alias_node');
}

/**
 * Implementation of hook_schema().
 */
function views_url_alias_node_schema() {
  return array(
    'views_url_alias_node' => array(
      'description' => t("A second url alias table for only node aliases used by views."),
      'fields' => array(
        'nid' => array(
          'description' => 'The related {node}.nid for the url alias.',
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'dst' => array(
          'description' => 'The alias for this path; e.g. title-of-the-story.',
          'type' => 'varchar',
          'length' => 255,
          // set to 255 (instead of 128) to accommodate longer urls.
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'primary key' => array(
        'nid',
      ),
      'unique keys' => array(
        'dst_nid' => array(
          'dst',
          'nid',
        ),
      ),
      'indexes' => array(
        'nid_dst' => array(
          'nid',
          'dst',
        ),
      ),
    ),
  );
}

Functions