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

Drupal example source code file (module_test.install)

This example Drupal source code file (module_test.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, behavior, data, description, function, inserted, module, of, php, record, schema, the, type, varchar

The module_test.install Drupal example source code

<?php
// $Id: module_test.install,v 1.1 2010/02/26 18:31:29 dries Exp $

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

/**
 * Implements hook_schema().
 */
function module_test_schema() {
  $schema['module_test'] = array(
    'description' => 'Dummy table to test the behavior of hook_schema() during module installation.',
    'fields' => array(
      'data' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'An example data column for the module.',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function module_test_install() {
  $record = array('data' => 'Data inserted in hook_install()');
  drupal_write_record('module_test', $record);
}

/**
 * Implements hook_enable().
 */
function module_test_enable() {
  $record = array('data' => 'Data inserted in hook_enable()');
  drupal_write_record('module_test', $record);
}

Other Drupal examples (source code examples)

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

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.