isotope.module in Isotope (with Masonry and Packery) 6
Same filename and directory in other branches
This adds the jquery.isotope.js library if found in the libraries folder
File
isotope.moduleView source
<?php
/**
* @file
* This adds the jquery.isotope.js library if found
* in the libraries folder
*/
/**
* Implements hook_init().
*
* Checks for conflicts, and displays warnings if they are detected
* Adds the configured library javascript to the site
*/
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');
}
}
/**
* Implements hook_menu().
*
* Defines the admin settings page for the module
*/
function isotope_menu() {
$items['admin/build/isotope'] = array(
'title' => 'Isotope.js Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'isotope_admin',
),
'access callback' => 'user_access',
'access arguments' => array(
'access administer isotope',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'includes/isotope.admin.inc',
);
return $items;
}
Functions
Name | Description |
---|---|
isotope_init | Implements hook_init(). |
isotope_menu | Implements hook_menu(). |