Commit 771b1b2b authored by metzlerd's avatar metzlerd
Browse files

Make sure if you call forena_report more than once that you don't ever call...

Make sure if you call forena_report more than once that you don't ever call drupal_add_js more than once because it mucks with the order of the javascript includes.
parent 8c0d75a2
......@@ -7,6 +7,7 @@
*/
class FrxWebDoc extends FrxDocument {
private $title;
static $js_added = [];
public function render($r, $format, $content=array()) {
// Set title based on report.
if ($r->title) {
......@@ -63,13 +64,16 @@ class FrxWebDoc extends FrxDocument {
}
// Add javascript files
foreach (Frx::Skin()->scripts as $script) {
if (strpos($script, 'http:') === 0 || strpos($script, 'https:') === 0) {
drupal_add_js($script, 'external');
}
else {
drupal_add_js($script);
$scripts = array_unique(Frx::Skin()->scripts);
foreach ($scripts as $script) {
if (empty(FrxWebDoc::$js_added[$script])) {
if (strpos($script, 'http:') === 0 || strpos($script, 'https:') === 0) {
drupal_add_js($script, 'external');
}
else {
drupal_add_js($script);
}
FrxWebDoc::$js_added[$script] = $script;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment