devdaily home | career | drupal | java | mac | mysql | perl | php | uml | unix

Drupal example source code file (contact.install)

This example Drupal source code file (contact.install) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, category, default, description, function, not, null, of, php, size, text, true, type

The contact.install Drupal example source code

<?php
// $Id: contact.install,v 1.10.2.1 2009/01/06 15:46:36 goba Exp $

/**
 * Implementation of hook_install().
 */
function contact_install() {
  // Create tables.
  drupal_install_schema('contact');
}

/**
 * Implementation of hook_uninstall().
 */
function contact_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('contact');

  variable_del('contact_default_status');
  variable_del('contact_form_information');
  variable_del('contact_hourly_threshold');
}

/**
 * Implementation of hook_schema().
 */
function contact_schema() {
  $schema['contact'] = array(
    'description' => 'Contact form category settings.',
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique category ID.',
      ),
      'category' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Category name.',
      ),
      'recipients' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Comma-separated list of recipient e-mail addresses.',
      ),
      'reply' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Text of the auto-reply message.',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => "The category's weight.",
      ),
      'selected' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)',
      ),
    ),
    'primary key' => array('cid'),
    'unique keys' => array(
      'category' => array('category'),
    ),
    'indexes' => array(
      'list' => array('weight', 'category'),
    ),
  );

  return $schema;
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal contact.install source code file:

new blog posts


 


"Drupal" is a registered trademark of Dries Buytaert.

our drupal tutorials and examples  
 
Sponsored by:
Mat-Su Valley Programming (Wasilla and Palmer, Alaska)

Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.