You are here

function jqmulti_get_files in jQuery Multi 6

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

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

2 calls to jqmulti_get_files()
jqmulti_admin_form in ./jqmulti.admin.inc
Admin form for jQuery Multi module.
jqmulti_alter_scripts in ./jqmulti.module
This is where the magic happens. The new jQuery is added and noConflict() is run. Finally, scripts are rearranged or added so that the targeted scripts run with the newer jQuery.

File

./jqmulti.module, line 131
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;
  }
  else {

    // Build files array.
    $files = module_invoke_all('jqmulti_files');
    if (!empty($files)) {
      $files = array_combine($files, $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) {
      $files = array_merge($files, jqmulti_get_library_files($library));
    }
    cache_set('jqmulti_files', $files);
    return $files;
  }
}