You are here

serial.install in Serial Field 6

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

Install, update and uninstall functions for the Serial module.

File

serial.install
View source
<?php

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

/**
 * Implementation of hook_install().
 */
function serial_install() {
  drupal_load('module', 'content');
  content_notify('install', 'serial');
  drupal_install_schema('serial');
}

/**
 * Implementation of hook_uninstall().
 */
function serial_uninstall() {
  drupal_load('module', 'content');
  content_notify('uninstall', 'serial');

  // TODO: Remove orphan serial fields (can always be added again)
  drupal_uninstall_schema('serial');
}

/**
 * Implementation of hook_enable().
 */
function serial_enable() {
  drupal_load('module', 'content');
  content_notify('enable', 'serial');
}

/**
 * Implementation of hook_disable().
 */
function serial_disable() {
  drupal_load('module', 'content');
  content_notify('disable', 'serial');
}

/**
 * Implementation of hook_schema().
 */
function serial_schema() {

  // Get the standard schema:
  module_load_include('inc', 'serial');
  $table_schema = _serial_get_table_schema();

  // Build the schema by iteration over all the serial field instances:
  $query = "SELECT type_name, field_name FROM {content_node_field_instance} WHERE widget_module = 'serial'";
  $result = db_query($query);
  $schema = array();
  while ($field = db_fetch_array($result)) {
    $table = _serial_get_field_table_name($field);
    $schema[$table] = $table_schema;
  }

  // Return the schema of all the assistant tables (one per serial field instance):
  return $schema;
}

Functions

Namesort descending Description
serial_disable Implementation of hook_disable().
serial_enable Implementation of hook_enable().
serial_install Implementation of hook_install().
serial_schema Implementation of hook_schema().
serial_uninstall Implementation of hook_uninstall().