You are here

function views_add_js in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 8.3 views.module \views_add_js()
  2. 6.3 views.module \views_add_js()
  3. 7.3 views.module \views_add_js()

Include views .js files.

6 calls to views_add_js()
template_preprocess_views_ui_edit_view in includes/admin.inc
Preprocess the view edit page.
template_preprocess_views_ui_list_views in includes/admin.inc
Preprocess the list views theme
template_preprocess_views_view in theme/theme.inc
Preprocess the primary theme implementation for a view.
views_exposed_form in ./views.module
Form builder for the exposed widgets form.
views_process_dependency in includes/form.inc
Process callback to add dependency to form items.

... See full list

File

./views.module, line 616
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_add_js($file) {

  // If javascript has been disabled by the user, never add js files.
  if (variable_get('views_no_javascript', FALSE)) {
    return;
  }
  static $base = TRUE;
  if ($base) {
    drupal_add_js(drupal_get_path('module', 'views') . "/js/base.js");
    $base = FALSE;
  }
  drupal_add_js(drupal_get_path('module', 'views') . "/js/{$file}.js");
}