You are here

domain_taxonomy.install in Domain Taxonomy 6

Same filename and directory in other branches
  1. 7.3 domain_taxonomy.install
  2. 7 domain_taxonomy.install

Install file.

File

domain_taxonomy.install
View source
<?php

/**
 * @file
 * Install file.
 */

/**
 * Implements hook_install()
 */
function domain_taxonomy_install() {
  drupal_install_schema('domain_taxonomy');
  $vocs = taxonomy_get_vocabularies();
  if (count($vocs) > 0) {
    $voc_options[] = '';
    foreach ($vocs as $voc) {
      variable_set('domain_disable_voc_' . $voc->vid, true);
      variable_set('domain_share_voc_' . $voc->vid, true);
    }
  }
}

/**
 * Implements hook_schema()
 */
function domain_taxonomy_schema() {
  $schema['domain_taxonomy_access'] = array(
    'fields' => array(
      'tid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'gid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'realm' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
      'grant_view' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
      'grant_update' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
      'grant_delete' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
    ),
    'primary key' => array(
      'tid',
      'gid',
      'realm',
    ),
    'indexes' => array(
      'tid' => array(
        'tid',
      ),
    ),
  );
  $schema['domain_taxonomy_source'] = array(
    'fields' => array(
      'tid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'domain_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall()
 */
function domain_taxonomy_uninstall() {
  drupal_uninstall_schema('domain_taxonomy');
}