You are here

webform_confirm_email.install in Webform Confirm Email Address 6.3

Webform confirm email module install/schema hooks.

File

webform_confirm_email.install
View source
<?php

/**
 * @file
 *   Webform confirm email module install/schema hooks.
 */

/**
 * Implementation of hook_schema().
 */
function webform_confirm_email_schema() {
  $schema = array();
  $schema['webform_confirm_email_code'] = array(
    'description' => 'Table for storing email confirmation codes.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node ID of a webform submission to be confirmed.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'sid' => array(
        'description' => 'Submission ID of a webform submission to be confirmed.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'eid' => array(
        'description' => 'The e-mail ID of a webform submission to be confirmed.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'code' => array(
        'description' => 'The hash code used for the confirmation link of a webform submission to be confirmed.',
        'type' => 'char',
        'length' => 32,
        'not null' => TRUE,
      ),
      'confirmation_emails' => array(
        'description' => 'The confirmation email(s) that will be send out when this submission was confirmed',
        'type' => 'text',
        'size' => 'medium',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'nid',
      'sid',
      'eid',
    ),
  );
  $schema['webform_confirm_email_confirmation_emails'] = array(
    'description' => 'Email definitions (from, to, subject, body, ...) for confirmation mails that are send after the user clicked the confirmation link.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node ID of a webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'eid' => array(
        'description' => 'Confirmation email identifier.',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
      'to_address' => array(
        'description' => 'The e-mail address that will be sent to upon submission. This may be an e-mail address, 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' => 'text',
        'not null' => FALSE,
      ),
      'from_name' => array(
        'description' => 'The e-mail "from" name 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,
      ),
      'from_address' => array(
        'description' => 'The e-mail "from" 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,
      ),
      'subject' => array(
        'description' => 'The e-mail subject 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,
      ),
      'template' => array(
        'description' => 'A template that will be used for the sent e-mail. This may be a string or the special key "default", which will use the template provided by the theming layer.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'excluded_components' => array(
        'description' => 'A list of components that will not be included in the %email_values token. A list of CIDs separated by commas.',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'html' => array(
        'description' => 'Determines if the e-mail will be sent in an HTML format. Requires Mime Mail module.',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'attachments' => array(
        'description' => 'Determines if the e-mail will include file attachments. Requires Mime Mail module.',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'eid',
    ),
  );
  $schema['webform_confirm_email'] = array(
    'description' => 'Table for storing email types.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node identifier of a webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'eid' => array(
        'description' => 'The e-mail identifier for this row\'s settings.',
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'eid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function webform_confirm_email_install() {
  drupal_install_schema('webform_confirm_email');
}

/**
 * Implementation of hook_uninstall().
 */
function webform_confirm_email_uninstall() {
  drupal_uninstall_schema('webform_confirm_email');
}

Functions