You are here

ife.install in Inline Form Errors 6

Same filename and directory in other branches
  1. 6.2 ife.install
  2. 7.2 ife.install
  3. 7 ife.install

Install file

@author Stijn De Meyere

File

ife.install
View source
<?php

/**
 * @file
 * Install file
 *
 * @author Stijn De Meyere
 */

/**
 * Implementation of hook_schema().
 */
function ife_schema() {
  $schema = array();

  // Table for positions and types of the challenges.
  $schema['ife'] = array(
    'description' => 'This table describes which form should be used with field messages and which field types should be converted.',
    'fields' => array(
      'form_id' => array(
        'description' => 'The form_id of the form to use with field messages.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'field_types' => array(
        'description' => 'Serialized array of the field types to convert.',
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
      ),
      'status' => array(
        'description' => 'Enabled boolean. 1 (True), 0 (False)',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'display' => array(
        'description' => 'Display type',
        'type' => 'int',
        'not null' => TRUE,
        'default' => -1,
      ),
    ),
    'primary key' => array(
      'form_id',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function ife_install() {
  drupal_install_schema('ife');
  db_query("UPDATE {system} SET weight = 1000 WHERE name = 'ife'");

  // insert some defaults
  $form_ids = array(
    'comment_form',
    'contact_mail_user',
    'contact_mail_page',
    'user_register',
    'user_pass',
    'user_login',
    'user_login_block',
    'forum_node_form',
  );
  foreach ($form_ids as $form_id) {
    db_query("INSERT INTO {ife} (form_id, field_types, status) VALUES ('%s', NULL, 0)", $form_id);
  }
}

/**
 * Implementation of hook_uninstall().
 */
function ife_uninstall() {
  drupal_uninstall_schema('ife');
  variable_del('ife_show_form_ids');
  variable_del('ife_display');
  variable_del('ife_general_message');
}

Functions

Namesort descending Description
ife_install Implementation of hook_install().
ife_schema Implementation of hook_schema().
ife_uninstall Implementation of hook_uninstall().