prettyphoto_formatters.install in prettyPhoto Formatters 7
Installation functions for prettyphoto_formatters.
File
prettyphoto_formatters.installView source
<?php
/**
* @file
* Installation functions for prettyphoto_formatters.
*/
/**
* Implements hook_requirements().
*/
function prettyphoto_formatters_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'install' || $phase == 'runtime') {
if (!_prettyphoto_formatters_requirements_library_installed()) {
$requirements['jquery.prettyPhoto'] = array(
'title' => $t('jQuery prettyPhoto Library'),
'severity' => REQUIREMENT_WARNING,
'value' => $t('Library required for prettyPhoto Formatter'),
'description' => $t('You need to install the jQuery prettyPhoto plugin. Create a directory in sites/all/libraries called jquery.prettyPhoto, and then copy js and css folders into it. You can download the plugin from !url.', array(
'!url' => l($t('here'), 'http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone', array(
'attributes' => array(
'target' => '_blank',
),
)),
)),
);
}
else {
$requirements['jquery.prettyPhoto'] = array(
'value' => $t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
$requirements['jquery.prettyPhoto']['title'] = $t('jQuery prettyPhoto Library');
}
return $requirements;
}
/**
* Implements hook_uninstall().
*/
function prettyphoto_formatters_uninstall() {
$variables = array(
'animation_speed',
'autoplay_slideshow',
'opacity',
'show_title',
'allow_resize',
'default_width',
'default_height',
'counter_separator_label',
'theme',
'horizontal_padding',
'hideflash',
'wmode',
'autoplay',
'modal',
'overlay_gallery',
'keyboard_shortcuts',
'ie6_fallback',
'social_tools',
'social_items',
'deeplinking',
'exclude_action',
'exclude_these_paths',
);
foreach ($variables as $variable) {
$name = 'prettyphoto_formatters_' . $variable;
variable_del($name);
}
}
/**
* Check if the library is available.
*
* @return mixed
* The path to the prettyPhoto library js file, or FALSE if not found.
*/
function _prettyphoto_formatters_requirements_library_installed() {
$pphoto_path = libraries_get_path('jquery.prettyPhoto');
if (!empty($pphoto_path)) {
if (!file_exists($pphoto_path . '/js/jquery.prettyPhoto.js')) {
$pphoto_path = FALSE;
}
}
else {
$pphoto_path = FALSE;
}
return $pphoto_path;
}
Functions
Name![]() |
Description |
---|---|
prettyphoto_formatters_requirements | Implements hook_requirements(). |
prettyphoto_formatters_uninstall | Implements hook_uninstall(). |
_prettyphoto_formatters_requirements_library_installed | Check if the library is available. |