function fp_add_js

6.x misc.inc fp_add_js($js, $type = "file")
4.x misc.inc fp_add_js($js, $type = "file")
5.x misc.inc fp_add_js($js, $type = "file")

Add extra javascript to the page.

  • type = file... $js is expected to be the path to a javascript file.
  • type = setting... $js is expected to be an associative array of settings. For example: array("my_path" => "blah", "my_color" => "red"). They will be available in javascript in the object FlightPath like so: FlightPath.settings.my_color;

Ex: fp_add_js(fp_get_module_path("admin") . '/js/admin.js');

See also

fp_add_css()

26 calls to fp_add_js()
admin_display_degrees_popup_add_group in modules/admin/admin.degrees.inc
admin_display_edit_degree in modules/admin/admin.degrees.inc
This screen displays the form which allows the user to actually edit a degree.
admin_display_groups in modules/admin/admin.groups.inc
This function will display a list of all our groups.
admin_display_groups_popup_edit_definition in modules/admin/admin.groups.inc
admin_display_groups_popup_select_icon in modules/admin/admin.groups.inc
This popup is called from the edit group page. It lets the user select an icon to assign to a group.

... See full list

File

includes/misc.inc, line 738
This file contains misc functions for FlightPath

Code

function fp_add_js($js, $type = "file") {
  if ($type == "file") {
    $GLOBALS ["fp_extra_js"][] = $js;
  }

  if ($type == "setting") {
    if (!is_array($GLOBALS ["fp_extra_js_settings"])) {
      $GLOBALS ["fp_extra_js_settings"] = array();
    }

    $GLOBALS ["fp_extra_js_settings"] = array_merge($GLOBALS ["fp_extra_js_settings"], $js);
  }

}