function fp_add_js
Search API
| 7.x misc.inc | fp_add_js($js, $type = "file") |
| 6.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
46 calls to fp_add_js()
- admin.courses.inc in modules/
admin/ admin.courses.inc - admin.degrees.inc in modules/
admin/ admin.degrees.inc - admin.groups.inc in modules/
admin/ admin.groups.inc - admin.module in modules/
admin/ admin.module - The administrative configurations for FlightPath.
- admin_display_degrees_popup_add_group in modules/
admin/ admin.degrees.inc
File
- includes/
misc.inc, line 1112 - This file contains misc functions for FlightPath
Code
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();
}
$GLOBALS ["fp_extra_js_settings"] = array_merge($GLOBALS ["fp_extra_js_settings"], $js);
}
}
