public function JuiceboxGallery::getJavascriptVars in Juicebox HTML5 Responsive Image Galleries 7.2
Get the variables needed to instantiate a new JS Juicebox. These values can be used as direct constructor inputs for a new juicebox object.
Parameters
string $xml_url: The URL to the Juicebox XML for this gallery.
Return value
array An associative array of properties that can be used as direct constructor inputs for a new JS Juicebox object.
Overrides JuiceboxGalleryInterface::getJavascriptVars
1 call to JuiceboxGallery::getJavascriptVars()
- JuiceboxGallery::renderJavascript in includes/
JuiceboxGallery.inc - Get the javascript code for a Juicebox gallery once images and options have been added.
File
- includes/
JuiceboxGallery.inc, line 271 - A php-only set of methods to create the script and markup components of a Juicebox gallery.
Class
- JuiceboxGallery
- Class to generate the script and markup for a Juicebox gallery.
Code
public function getJavascriptVars($xml_url) {
$vars = array(
'configUrl' => $xml_url,
'containerId' => $this
->getId(),
);
// Add options that need to be loaded immediately (before XML is available).
$load_before_xml = array(
'gallerywidth',
'galleryheight',
'backgroundcolor',
'themeurl',
'baseurl',
'showpreloader',
'debugmode',
);
$current_options = $this
->getOptions(TRUE);
foreach ($load_before_xml as $key => $option) {
if (!empty($current_options[$option])) {
$vars[$option] = $current_options[$option];
}
}
return $vars;
}