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

Drupal example source code file (number.install)

This example Drupal source code file (number.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

abort, array, content, content_clear_type_cache, function, number, number_install, number_update_6000, php, return, set, type, update, where

The number.install Drupal example source code

<?php
// $Id: number.install,v 1.28.2.6 2008/10/04 13:14:22 karens Exp $

/**
 * @file
 * Implementation of hook_install().
 */
function number_install() {
  drupal_load('module', 'content');
  content_notify('install', 'number');
}

/**
 * Implementation of hook_uninstall().
 */
function number_uninstall() {
  drupal_load('module', 'content');
  content_notify('uninstall', 'number');
}

/**
 * Implementation of hook_enable().
 *
 * Notify content module when this module is enabled.
 */
function number_enable() {
  drupal_load('module', 'content');
  content_notify('enable', 'number');
}

/**
 * Implementation of hook_disable().
 *
 * Notify content module when this module is disabled.
 */
function number_disable() {
  drupal_load('module', 'content');
  content_notify('disable', 'number');
}

function number_update_last_removed() {
  return 5;
}

/**
 * Rename old decimal fields, which were really floats, to float
 */
function number_update_6000() {
  if ($abort = content_check_update('number')) {
    return $abort;
  }

  $ret = array();

  drupal_load('module', 'content');
  $ret[] = update_sql("UPDATE {". content_field_tablename() ."} SET type='number_float' WHERE type = 'number_decimal'");

  content_clear_type_cache();
  return $ret;
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal number.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.