lazyloader.install in Image Lazyloader 7.2
Same filename and directory in other branches
Lazyloader Install
@author: Daniel Honrade http://drupal.org/user/351112
File
lazyloader.installView 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_custom_icon_path',
'lazyloader_page_exclude_option',
'lazyloader_content_types',
'lazyloader_load_image_delay',
'lazyloader_debounce',
'lazyloader_unload',
'lazyloader_debugging',
);
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');
}
/**
* Rename lazyloader_exclude_option to lazyloader_path_exclude_option.
*/
function lazyloader_update_7201() {
// Move the settings to their new variable if they differ from the default.
$val = variable_get('lazyloader_exclude_option', LAZYLOADER_PAGE_EXCLUDE_OPTION);
if ($val !== LAZYLOADER_PAGE_EXCLUDE_OPTION) {
variable_set('lazyloader_page_exclude_option', $val);
}
// Remove the old value.
variable_del('lazyloader_exclude_option');
}
Functions
Name | Description |
---|---|
lazyloader_install | Implements hook_install(). |
lazyloader_uninstall | Implements hook_uninstall(). |
lazyloader_update_7001 | Migrate settings. |
lazyloader_update_7201 | Rename lazyloader_exclude_option to lazyloader_path_exclude_option. |