function isotope_init in Isotope (with Masonry and Packery) 6
Same name and namespace in other branches
- 7 isotope.module \isotope_init()
Implements hook_init().
Checks for conflicts, and displays warnings if they are detected Adds the configured library javascript to the site
File
- ./
isotope.module, line 14 - This adds the jquery.isotope.js library if found in the libraries folder
Code
function isotope_init() {
if (arg(2) == 'edit') {
}
elseif (arg(0) != 'admin') {
module_load_include('module', 'libraries');
$libpath = libraries_get_path('isotope');
$scripts = variable_get('isotope_settings', array());
foreach ($scripts as $script) {
if ($script) {
$jspath = check_plain($libpath . '/js/' . $script . '.min.js');
drupal_add_js($jspath);
}
}
// Add the library if the file structure looks correct.
if (is_dir($libpath) != TRUE || !drupal_add_js($libpath . '/jquery.isotope.js')) {
drupal_set_message(t('The Isotope Library module is enabled but the library itself was not loaded.') . ' ' . l(t('Download the Isotope.js library'), 'https://github.com/desandro/isotope.git') . ' ' . t('into sites/<yoursitenamehere>/libraries/isotope in order to use the module.'), 'error', FALSE);
return;
}
drupal_add_js($libpath . '/jquery.isotope.js');
}
}