function fp_add_js

7.x fp_add_js($js, $type = "file")
6.x fp_add_js($js, $type = "file")
4.x fp_add_js($js, $type = "file")
5.x 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


47 calls to fp_add_js()
admin_display_degrees_popup_add_group2 in modules/admin/
admin_display_groups in modules/admin/
This function will display a list of all our groups.
admin_display_groups_popup_edit_definition in modules/admin/
admin_display_groups_popup_select_icon in modules/admin/
This popup is called from the edit group page. It lets the user select an icon to assign to a group.
admin_display_main in modules/admin/admin.module
This is the "main" page for the admin module. It's what the user first sees when the click to go to the Admin page.

... See full list


includes/, line 1840
This file contains misc functions for FlightPath


function fp_add_js($js, $type = "file") {

  // Init if needed
  if (!isset($GLOBALS ['fp_extra_js'])) {
    $GLOBALS ['fp_extra_js'] = array();

  if ($type == "file") {
    if (!in_array($js, $GLOBALS ['fp_extra_js'])) {
      $GLOBALS ["fp_extra_js"][] = $js;

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

    // Instead of using array_merge_recursive, this guarantees that keys are not re-used.    
    foreach ($js as $key => $val) {
      $GLOBALS ["fp_extra_js_settings"][$key] = $val;