You are here

lazyloader.install in Image Lazyloader 7

Same filename and directory in other branches
  1. 8 lazyloader.install
  2. 7.2 lazyloader.install

Lazyloader Install

@author: Daniel Honrade http://drupal.org/user/351112

File

lazyloader.install
View source
<?php

/**
 * @file
 * Lazyloader Install
 *
 * @author: Daniel Honrade http://drupal.org/user/351112
 *
 */

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

  // Make sure this module called last to override any form provided by other
  // modules.
  db_query("UPDATE {system} SET weight = 3000 WHERE name = 'lazyloader'");
}

/**
 * Implements hook_uninstall().
 */
function lazyloader_uninstall() {
  $variables = array(
    'lazyloader_enabled',
    'lazyloader_distance',
    'lazyloader_placeholder',
    'lazyloader_icon',
    'lazyloader_paths',
    'lazyloader_exclude_option',
    'lazyloader_load_image_delay',
  );
  foreach ($variables as $variable) {
    variable_del($variable);
  }
}

/**
 * Migrate settings.
 */
function lazyloader_update_7001() {
  $settings = variable_get('lazyloader', array());
  if (isset($settings['enabled'])) {
    variable_set('lazyloader_enabled', $settings['enabled']);
  }
  if (isset($settings['distance'])) {
    variable_set('lazyloader_distance', $settings['distance']);
  }
  if (isset($settings['placeholder'])) {
    variable_set('lazyloader_placeholder', $settings['placeholder']);
  }
  if (isset($settings['loader_icon'])) {
    variable_set('lazyloader_icon', $settings['loader_icon']);
  }
  if (isset($settings['exclude'])) {
    variable_set('lazyloader_paths', $settings['exclude']);
  }
  variable_del('lazyloader');
}

Functions

Namesort descending Description
lazyloader_install Implements hook_install().
lazyloader_uninstall Implements hook_uninstall().
lazyloader_update_7001 Migrate settings.