You are here

lang_dropdown.install in Language Switcher Dropdown 7.2

Same filename and directory in other branches
  1. 6 lang_dropdown.install
  2. 7 lang_dropdown.install

Install, update, and uninstall functions for the LSD module.

File

lang_dropdown.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the LSD module.
 */

/**
 * Implements hook_install().
 */
function lang_dropdown_install() {
  drupal_set_message(st("<b>Language switcher dropdown</b> is installed successfully.<br />Please refer to README.txt for help in configuration."));
}

/**
 * Implements hook_uninstall().
 */
function lang_dropdown_uninstall() {
  variable_del('lang_dropdown');
  variable_del('lang_dropdown_' . LANGUAGE_TYPE_INTERFACE);
  variable_del('lang_dropdown_' . LANGUAGE_TYPE_CONTENT);
  variable_del('lang_dropdown_' . LANGUAGE_TYPE_URL);
}

/**
 * Rearrange options arrays.
 */
function lang_dropdown_update_7201() {
  $types = array(
    '',
    LANGUAGE_TYPE_INTERFACE,
    LANGUAGE_TYPE_CONTENT,
    LANGUAGE_TYPE_URL,
  );
  foreach ($types as $type) {
    if ($options = variable_get('lang_dropdown' . (empty($type) ? '' : '_' . $type), FALSE)) {
      $options['width'] = $options['js_widget_settings']['width'];
      unset($options['js_widget_settings']['width']);
      $options['widget'] = $options['js_widget'];
      unset($options['js_widget']);
      $options['msdropdown'] = $options['js_widget_settings'];
      unset($options['js_widget_settings']);
      variable_set('lang_dropdown' . (empty($type) ? '' : '_' . $type), $options);
    }
  }
}

Functions

Namesort descending Description
lang_dropdown_install Implements hook_install().
lang_dropdown_uninstall Implements hook_uninstall().
lang_dropdown_update_7201 Rearrange options arrays.