You are here

i18n_path.install in Internationalization 7

Install, update and uninstall functions for the text module.

File

i18n_path/i18n_path.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the text module.
 */

/**
 * Implements hook_install().
 */
function i18n_path_install() {

  // Set module weight for it to run after core modules, but before views.
  db_update('system')
    ->fields(array(
    'weight' => 5,
  ))
    ->condition('name', 'i18n_path', '=')
    ->condition('type', 'module', '=')
    ->execute();
}

/**
 * Implements hook_schema().
 */
function i18n_path_schema() {
  $schema['i18n_path'] = array(
    'description' => 'Path translation',
    'fields' => array(
      'tpid' => array(
        'description' => 'The primary identifier for a path in the translation set.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'tsid' => array(
        'description' => 'The primary identifier for a translation set.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'path' => array(
        'description' => 'The Drupal path this alias is for; e.g. node/12.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'language' => array(
        'description' => "The language for which this path is a translation.",
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'pid' => array(
        'description' => 'A unique path alias identifier if the path has an alias.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'path' => array(
        'path',
      ),
    ),
    'unique keys' => array(
      'set_language' => array(
        'tsid',
        'language',
      ),
    ),
    'foreign keys' => array(
      'path_language' => array(
        'table' => 'languages',
        'columns' => array(
          'language' => 'language',
        ),
      ),
      'translation_set' => array(
        'table' => 'i18n_translation',
        'columns' => array(
          'tsid' => 'tsid',
        ),
      ),
    ),
    'primary key' => array(
      'tpid',
    ),
  );
  return $schema;
}

/**
 * Set module weight.
 */
function i18n_path_update_7000(&$sandbox) {

  // Set module weight for it to run after core modules, but before views.
  db_update('system')
    ->fields(array(
    'weight' => 5,
  ))
    ->condition('name', 'i18n_path', '=')
    ->condition('type', 'module', '=')
    ->execute();
}

Functions

Namesort descending Description
i18n_path_install Implements hook_install().
i18n_path_schema Implements hook_schema().
i18n_path_update_7000 Set module weight.