You are here

function views_isotope_check_additional_libraries in Brainstorm profile 7

Check for all additional libraries.

Return the ones that have been detected, or an empty array. If passed a specific libname to check for, will return the path to the library or FALSE.

3 calls to views_isotope_check_additional_libraries()
views_isotope_addjs in modules/custom/views_isotope/views_isotope.module
Function to add the right version of the js file.
views_isotope_ctools_export_ui_form in modules/custom/views_isotope/plugins/export_ui/views_isotope_ctools_export_ui.inc
Define the configuration add/edit form.
views_isotope_default_isotope_configuration in modules/custom/views_isotope/views_isotope.module
Implements hook_default_views_isotope_preset().

File

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

Code

function views_isotope_check_additional_libraries($libname = FALSE) {
  $detected_libraries = [];
  $libraries = views_isotope_additional_libraries_list();
  if (function_exists('libraries_get_path')) {
    foreach ($libraries as $lib_name => $library) {

      // Check both for files inside the "isotope" folder and files inside a
      // plugin-named folder.
      $layout_path = libraries_get_path('isotope') . '/' . $library['filename'];
      if (file_exists($layout_path) === TRUE) {
        $detected_libraries[$layout_path] = $lib_name;
      }
      $plugin_path = libraries_get_path($lib_name) . '/' . $library['filename'];
      if (file_exists($plugin_path) === TRUE) {
        $detected_libraries[$plugin_path] = $lib_name;
      }
    }
  }
  if ($libname && in_array($libname, $detected_libraries)) {
    return array_search($libname, $detected_libraries);
  }
  elseif ($libname) {
    return FALSE;
  }
  return $detected_libraries;
}