You are here

function isotope_addjs in Isotope (with Masonry and Packery) 7.2

Function to add the right version of the js file.

1 call to isotope_addjs()
theme_isotope_grid in ./isotope.module
Default theme implementation for the grid.

File

./isotope.module, line 269
Load the isotope library and provide configuration and theme options.

Code

function isotope_addjs($config_name) {
  $isotope_scope = isotope_check_library();
  if ($isotope_scope == 'library') {
    drupal_add_js(libraries_get_path('isotope') . '/' . ISOTOPE_FILENAME);
  }
  elseif ($isotope_scope == 'cdn') {
    drupal_add_js(ISOTOPE_CDN_PATH, 'external');
  }
  ctools_include('export');
  $config = ctools_export_crud_load('isotope_configurations', $config_name);
  $libraries = isotope_additional_libraries_list();
  $selected_libraries = array(
    $config->layoutMode,
  );
  foreach ($config->plugins as $value) {
    if (!empty($value)) {
      $selected_libraries[] = $value;
    }
  }
  foreach ($selected_libraries as $lib_name) {
    if (!empty($libraries[$lib_name])) {
      $path = isotope_check_additional_libraries($lib_name);
      if (!empty($path)) {
        drupal_add_js($path);
      }
    }
  }
}