Commit a5012e5c authored by Lisa Seeto's avatar Lisa Seeto Committed by Robert Lyon

Bug 1855023: Warning produced when adding/ editing an image gallery block

- changed for loop in get_get_javascript_javascript func to continue
when encountering empty filename vars.

behatnotneeded

Change-Id: I5b65c4beee4465d80911aa3fe08590a358570141
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 44b91057
......@@ -2085,9 +2085,9 @@ class BlockInstance {
* Returns javascript to grab & eval javascript from files on the web
*
* @param array $jsfiles Each element of $jsfiles is either a url, a local filename,
* or an array of the form
* or an array in the form of
* array(
* 'file' => string // url or local js filename
* 'file' => string // url or local js filename (or empty if initjs only is required)
* 'initjs' => string // js to be executed once the file's
* // contents have been loaded
* )
......@@ -2097,7 +2097,11 @@ class BlockInstance {
public function get_get_javascript_javascript($jsfiles) {
$js = '';
foreach ($jsfiles as $jsfile) {
if (is_array($jsfile) && empty($jsfile['file']) && !empty($jsfile['initjs'])) {
// Just dealing with initjs option only so do this on page load
$js .= "jQuery(function() {\n" . $jsfile['initjs'] . "\n})";
}
else {
$file = (is_array($jsfile) && !empty($jsfile['file'])) ? $jsfile['file'] : $jsfile;
if (stripos($file, 'http://') === false && stripos($file, 'https://') === false) {
......@@ -2115,6 +2119,7 @@ class BlockInstance {
}
$js .= "});\n";
}
}
return $js;
}
......
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