auto_height.install in jQuery Auto Height 7
Same filename and directory in other branches
Install, update and uninstall functions for the 'jQuery Auto Height' module.
File
auto_height.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the 'jQuery Auto Height' module.
*/
/**
* If the plugin doesn't exist, show a warning on the status report page
*/
function auto_height_requirements($phase) {
$requirements = array();
switch ($phase) {
case 'runtime':
$path = libraries_get_path('autoheight') . '/jquery.autoheight.js';
$installed = file_exists($path);
if (!$installed) {
$requirements[] = array(
'title' => t('jQuery AutoHeight plugin'),
'value' => t('Missing'),
'description' => t('The jQuery AutoHeight plugin is missing. Download it from !autoheight-url and copy it to !autoheight-library/!autoheight-filename.', array(
'!autoheight-url' => l(AUTOHEIGHT_PLUGIN_URL, AUTOHEIGHT_PLUGIN_URL, array(
'external' => TRUE,
)),
'!autoheight-library' => libraries_get_path('autoheight'),
'!autoheight-filename' => AUTOHEIGHT_PLUGIN_FILENAME,
)),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements[] = array(
'title' => t('jQuery AutoHeight plugin'),
'value' => t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
break;
}
return $requirements;
}
/**
* Enable the module
*/
function auto_height_enable() {
$path = libraries_get_path('autoheight') . '/jquery.autoheight.js';
$installed = file_exists($path);
if (!$installed) {
$message = t('Require the jQuery AutoHeight plugin to use this module. Download it from !autoheight-url and place it to the sites/all/libraries/autoheight directory i.e. sites/all/libraries/autoheight/!autoheight-filename.', array(
'!autoheight-url' => l(t('here'), AUTOHEIGHT_PLUGIN_URL),
'!autoheight-filename' => AUTOHEIGHT_PLUGIN_FILENAME,
));
drupal_set_message(filter_xss_admin($message), $type = 'warning');
}
else {
$message = t('You have the jQuery AutoHeight plugin installed. Configure the module !autoheight-configuration', array(
'!autoheight-configuration' => l(t('here'), 'admin/config/media/auto_height'),
));
drupal_set_message(filter_xss_admin($message));
}
}
/**
* Uninstall the module
*/
function auto_height_uninstall() {
// Delete module variables
variable_del('autoheight_selectors');
}
Functions
Name | Description |
---|---|
auto_height_enable | Enable the module |
auto_height_requirements | If the plugin doesn't exist, show a warning on the status report page |
auto_height_uninstall | Uninstall the module |