function shadowbox_requirements in Shadowbox 5
Same name and namespace in other branches
- 8 shadowbox.install \shadowbox_requirements()
- 5.2 shadowbox.install \shadowbox_requirements()
- 6.4 shadowbox.install \shadowbox_requirements()
- 6 shadowbox.install \shadowbox_requirements()
- 6.2 shadowbox.install \shadowbox_requirements()
- 6.3 shadowbox.install \shadowbox_requirements()
- 7.4 shadowbox.install \shadowbox_requirements()
- 7.3 shadowbox.install \shadowbox_requirements()
Implementation of hook_requirements().
File
- ./
shadowbox.install, line 18 - Shadowbox module install file.
Code
function shadowbox_requirements($phase) {
$requirements = array();
$t = get_t();
switch ($phase) {
case 'install':
case 'runtime':
$path = drupal_get_path('module', 'shadowbox');
if (!file_exists($path . '/shadowbox/')) {
$requirements['shadowbox'] = array(
'title' => $t('Shadowbox'),
'description' => $t('In order for the Shadowbox module to work correctly, the Shadowbox \'full\' distribution must exists at <code>%path</code>.', array(
'%path' => $path . '/shadowbox',
)),
'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
'value' => $t('Install 3rd party Shadowbox software'),
);
}
elseif (!file_exists($path . '/shadowbox/build/js/shadowbox.js') || !file_exists($path . '/shadowbox/build/js/adapter/shadowbox-jquery.js') || !file_exists($path . '/shadowbox/build/css/shadowbox.css')) {
$requirements['shadowbox'] = array(
'title' => $t('Shadowbox'),
'description' => $t('The <code>%path</code> path exists but it appears that the directory structure underneath is not correct. Please check that <code>%shadowbox</code>, <code>%jquery</code> and <code>%css</code> exist.', array(
'%path' => $path . '/shadowbox',
'%shadowbox' => $path . '/shadowbox/build/js/shadowbox.js',
'%jquery' => $path . '/shadowbox/build/js/adapter/shadowbox-jquery.js',
'%css' => $path . '/shadowbox/build/css/shadowbox.css',
)),
'severity' => $phase == 'install' ? REQUIREMENT_WARNING : REQUIREMENT_ERROR,
'value' => $t('3rd party Shadowbox software not properly installed'),
);
}
elseif ($phase == 'runtime') {
$requirements['shadowbox'] = array(
'title' => $t('Shadowbox'),
'severity' => REQUIREMENT_OK,
'value' => $t('Installed correctly'),
);
}
}
return $requirements;
}