You are here

nodereference.install in Content Construction Kit (CCK) 6

File

modules/nodereference/nodereference.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function nodereference_install() {
  content_notify('install', 'nodereference');
}

/**
 * Implementation of hook_uninstall().
 */
function nodereference_uninstall() {
  content_notify('uninstall', 'nodereference');
}

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

/**
 * Implementation of hook_disable().
 *
 * Notify content module when this module is disabled.
 */
function nodereference_disable() {
  content_notify('disable', 'nodereference');
}
function nodereference_update_last_removed() {
  return 3;
}

/**
 * All fields must allow NULL values to indicate empty fields.
 */
function nodereference_update_6000() {
  $ret = array();
  include_once './' . drupal_get_path('module', 'content') . '/content.module';
  content_clear_type_cache();
  include_once './' . drupal_get_path('module', 'content') . '/content.install';
  $types = content_types_install();
  foreach ($types as $type_name => $fields) {
    foreach ($fields as $field) {
      switch ($field['type']) {
        case 'nodereference':
          $db_info = content_database_info($field);
          $table = $db_info['table'];
          $column = $db_info['columns']['nid']['column'];
          db_change_field($ret, $table, $column, $column, array(
            'type' => 'int',
            'not null' => FALSE,
          ));
          db_field_set_no_default($ret, $db_info['table'], $column);
          $ret[] = update_sql("UPDATE {" . $db_info['table'] . "} SET " . $column . " = NULL WHERE " . $column . " = 0");
      }
    }
  }
  return $ret;
}

Functions

Namesort descending Description
nodereference_disable Implementation of hook_disable().
nodereference_enable Implementation of hook_enable().
nodereference_install Implementation of hook_install().
nodereference_uninstall Implementation of hook_uninstall().
nodereference_update_6000 All fields must allow NULL values to indicate empty fields.
nodereference_update_last_removed