You are here

function jqmulti_get_files in jQuery Multi 7

Same name and namespace in other branches
  1. 6 jqmulti.module \jqmulti_get_files()

Returns a list of files that should be loaded with the second jQuery.

3 calls to jqmulti_get_files()
jqmulti_admin_form in ./jqmulti.admin.inc
Admin form for jQuery Multi module.
jqmulti_js_alter in ./jqmulti.module
Implements hook_js_alter().
jqmulti_update_7101 in ./jqmulti.install
Refresh the files listing.

File

./jqmulti.module, line 106
Code for the jQuery Multi module.

Code

function jqmulti_get_files($reset = FALSE) {

  // We store the file list in cache, since it's not going to change much.
  if (!$reset && ($cache = cache_get('jqmulti_files'))) {
    return $cache->data;
  }

  // Build files array.
  $files = module_invoke_all('jqmulti_files');
  $libraries = module_invoke_all('jqmulti_libraries');

  // Get also any libraries added by UI.
  $ui_libs = variable_get('jqmulti_libraries', array());
  foreach ($ui_libs as $ui_lib => $on) {
    if ($on && !in_array($ui_lib, $libraries)) {
      $libraries[] = $ui_lib;
    }
  }

  // Add library files.
  foreach ($libraries as $library) {
    $lib_files = jqmulti_get_library_files($library);
    foreach ($lib_files as $lib_file) {
      $files[] = $lib_file;
    }
  }

  // Make all files keys in the array.
  $temp_files = array();
  foreach ($files as $key => $value) {
    if (is_array($value)) {
      $temp_files[$key] = $value;
    }
    else {
      $temp_files[$value] = array();
    }
  }
  $files = $temp_files;
  cache_set('jqmulti_files', $files);
  return $files;
}