You are here

function views_isotope_addjs in Brainstorm profile 7

Function to add the right version of the js file.

1 call to views_isotope_addjs()
theme_isotope_grid in modules/custom/views_isotope/views_isotope.module
Default theme implementation for the grid.

File

modules/custom/views_isotope/views_isotope.module, line 266
Load the isotope library and provide configuration and theme options.

Code

function views_isotope_addjs($config_name) {
  $isotope_scope = views_isotope_check_library();
  if ($isotope_scope == 'library') {
    drupal_add_js(libraries_get_path('isotope') . '/' . VIEWS_ISOTOPE_FILENAME);
  }
  elseif ($isotope_scope == 'cdn') {
    drupal_add_js(VIEWS_ISOTOPE_CDN_PATH, 'external');
  }
  ctools_include('export');
  $config = ctools_export_crud_load('isotope_configurations', $config_name);
  $libraries = views_isotope_additional_libraries_list();
  $selected_libraries = [
    $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 = views_isotope_check_additional_libraries($lib_name);
      if (!empty($path)) {
        drupal_add_js($path);
      }
    }
  }
}