You are here

webform_reply_to.install in Webform Reply To 7

Same filename and directory in other branches
  1. 6 webform_reply_to.install
  2. 7.2 webform_reply_to.install

Install, update and uninstall functions for the Webform Reply-To module.

File

webform_reply_to.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the Webform Reply-To module.
 */

/**
 * Implements hook_schema_alter().
 */
function webform_reply_to_schema_alter(&$schema) {

  // Add reply_to field to existing schema.
  $schema['webform_emails']['fields']['reply_to'] = array(
    'description' => 'The "Reply-To" e-mail address that will be used. This may be a string, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
    'default' => 'default',
  );
}

/**
 * Implements hook_install().
 */
function webform_reply_to_install() {

  // Insert the reply_to field.
  db_add_field('webform_emails', 'reply_to', array(
    'description' => 'The "Reply-To" e-mail address that will be used. This may be a string, the special key "default" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
    'default' => 'default',
    'initial' => 'default',
  ));
}

/**
 * Implements hook_uninstall().
 */
function webform_reply_to_uninstall() {

  // Delete variables.
  db_query("DELETE FROM {variable} WHERE name LIKE 'webform_reply_to_%%'");

  // Drop the reply_to field.
  db_drop_field('webform_emails', 'reply_to');
}