You are here

rules_forms.install in Rules Forms Support 7

Same filename and directory in other branches
  1. 7.2 rules_forms.install

Installation function for Rules Forms module.

File

rules_forms.install
View source
<?php

/**
 * @file
 * Installation function for Rules Forms module.
 */

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

  // Set the modules' weight to 20, because we want it to be the last one using
  // hook_form_alter().
  db_update('system')
    ->fields(array(
    'weight' => 20,
  ))
    ->condition('name', 'rules_forms')
    ->execute();
}

/**
 * Implements hook_enable().
 */
function rules_forms_enable() {
  $t = get_t();

  // Notify the user of configuration requirements for Rules Forms.
  $link = l(t('enable Rules Forms rules'), RULES_FORMS_ADMIN_PATH);
  drupal_set_message($t('You may now !rules_forms_settings_link for individual forms. For more information please consult the documentation in README.txt in your Rules forms support module folder.', array(
    '!rules_forms_settings_link' => $link,
  )), 'status');
}

/**
 * Implements hook_uninstall().
 */
function rules_forms_uninstall() {
  variable_del('rules_forms_form_info');
}

/**
 * Deletes the old variable.
 */
function rules_forms_update_7101() {
  variable_del('rules_forms_events');
}

/**
 * Unset rules_forms_event_info array values with empty keys.
 *
 * To cleanse the settings array of bad form information.
 *
 * @see http://drupal.org/node/1447328#comment-5640172
 */
function rules_forms_update_7102() {
  $event_info = variable_get('rules_forms_event_info', array());
  foreach ($event_info as $key => $value) {

    // Any form of empty key is unwanted (NULL, 0, FALSE, '', etc).
    if (empty($key)) {
      unset($event_info[$key]);
    }
  }
  variable_set('rules_forms_event_info', $event_info);
}

/**
 * Change Rules Forms settings variable name.
 */
function rules_forms_update_7103() {
  $form_info = variable_get('rules_forms_event_info', array());
  variable_set('rules_forms_form_info', $form_info);
  variable_del('rules_forms_event_info');
}

Functions

Namesort descending Description
rules_forms_enable Implements hook_enable().
rules_forms_install Implements hook_install().
rules_forms_uninstall Implements hook_uninstall().
rules_forms_update_7101 Deletes the old variable.
rules_forms_update_7102 Unset rules_forms_event_info array values with empty keys.
rules_forms_update_7103 Change Rules Forms settings variable name.