You are here

webform_select_opts.install in Webform Select options 7.2

Same filename and directory in other branches
  1. 7.3 webform_select_opts.install
  2. 7 webform_select_opts.install

Install schema module Webform select options.

File

webform_select_opts.install
View source
<?php

/**
 * @file
 * Install schema module Webform select options.
 */

/**
 * Implements hook_schema().
 */
function webform_select_opts_schema() {
  $schema = array();
  $schema['webform_select_opts_component'] = array(
    'description' => 'Webform component additional custom options',
    'fields' => array(
      'nid' => array(
        'description' => 'The {node}.nid webform this record affects.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'cid' => array(
        'description' => 'Component ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'Custom data.',
        'type' => 'varchar',
        'length' => 555,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'cid' => array(
        'cid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 *
 */
function webform_select_opts_uninstall() {
  $vars_prefix = array(
    'webform_select_options_fields_',
    'webform_select_options_for_',
  );
  foreach ($vars_prefix as $var_prefix) {
    db_query('DELETE FROM variable WHERE name LIKE :pattern', array(
      ':pattern' => db_like($var_prefix) . '%',
    ));
  }
}

Functions