function photoswipe_init in PhotoSwipe 6
Same name and namespace in other branches
- 7 photoswipe.module \photoswipe_init()
Implementation of hook_init().
File
- ./
photoswipe.module, line 26
Code
function photoswipe_init() {
// Load photoswipe only on specified nodes
if (variable_get('photoswipe_enabled', TRUE) && photoswipe_active_url() && !drupal_match_path('filter/tips', $_GET['q']) && photoswipe_active_nodetype() && ($path = libraries_get_path('photoswipe'))) {
$useJquery = variable_get('photoswipe_use_jquery', FALSE);
drupal_add_js($path . '/lib/klass.min.js', 'module');
if ($useJquery) {
drupal_add_js($path . '/lib/jquery-1.6.2.min.js', 'module');
drupal_add_js($path . '/code.photoswipe.jquery-2.0.0.min.js', 'module');
drupal_add_js(drupal_get_path('module', 'photoswipe') . '/photoswipe.jquery.js');
}
else {
global $psFile;
drupal_add_js($path . '/' . $psFile, 'module');
drupal_add_js(drupal_get_path('module', 'photoswipe') . '/photoswipe.js');
}
drupal_add_css($path . '/photoswipe.css', 'module');
// Pass variables to photoswipe.jquery.js
global $defaultConfigString;
drupal_add_js(array(
'photoswipe' => array(
'useJquery' => $useJquery,
'configString' => variable_get('photoswipe_custom_config', $defaultConfigString),
),
), 'setting');
drupal_add_js('var photoswipeConfig = {' . variable_get('photoswipe_custom_config', $defaultConfigString) . '};', 'inline');
}
}