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") |
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
32 calls to fp_add_js()
- admin_display_degrees_popup_add_group in modules/
admin/ admin.degrees.inc - admin_display_degrees_popup_add_group2 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
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);
}
}