You are here

webform_steps_w3.install in Webform steps 7.3

Same filename and directory in other branches
  1. 7.2 webform_steps_w3/webform_steps_w3.install

File

webform_steps_w3/webform_steps_w3.install
View source
<?php

/**
 * Implements hook_schema().
 */
function webform_steps_w3_schema() {
  $schema['webform_steps_w3_progressbar'] = array(
    'description' => 'Table for storing progressbar settings for webforms.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node identifier of a webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'progressbar_bar' => array(
        'description' => 'Boolean value indicating if the bar should be shown as part of the progress bar.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'progressbar_page_number' => array(
        'description' => 'Boolean value indicating if the page number should be shown as part of the progress bar.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'progressbar_percent' => array(
        'description' => 'Boolean value indicating if the percentage complete should be shown as part of the progress bar.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'progressbar_pagebreak_labels' => array(
        'description' => 'Boolean value indicating if the pagebreak labels should be included as part of the progress bar.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'progressbar_label_first' => array(
        'description' => 'Label for the first page of the progress bar.',
        'type' => 'varchar',
        'length' => 255,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_disable().
 */
function webform_steps_w3_disable() {

  // Migrate all data from this module to {webform} if webform-7.x-4.x is installed.
  if (db_field_exists('webform', 'progressbar_bar')) {
    webform_steps_w3_migrate();
  }
}

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

  // If this module is uninstalled and there is no webform-7.x-4.x installed
  // Remove the variables.
  if (!db_table_exists('webform') || !db_field_exists('webform', 'progressbar_bar')) {
    variable_del('webform_progressbar_style');
    variable_del('webform_progressbar_label_first');
    variable_del('webform_progressbar_label_confirmation');
  }
}