Same name and namespace in other branches
  1. 6.x-3.x views.module \views_add_js()

Include views .js files.

3 calls to views_add_js()
template_preprocess_views_view in theme/theme.inc
Preprocess the primary theme implementation for a view.
views_plugin_display::option_link in plugins/views_plugin_display.inc
Because forms may be split up into sections, this provides an easy URL to exactly the right section. Don't override this.
views_ui::list_render in plugins/export_ui/views_ui.class.php
Render all of the rows together.

File

./views.module, line 1295
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, $ajax = TRUE;
  if ($base) {
    drupal_add_js(drupal_get_path('module', 'views') . "/js/base.js");
    $base = FALSE;
  }
  if ($ajax && in_array($file, array(
    'ajax',
    'ajax_view',
  ))) {
    drupal_add_library('system', 'drupal.ajax');
    drupal_add_library('system', 'jquery.form');
    $ajax = FALSE;
  }
  ctools_add_js($file, 'views');
}