-
Notifications
You must be signed in to change notification settings - Fork 0
/
accordion.php
26 lines (23 loc) · 1.09 KB
/
accordion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// Accordion extension, https://github.com/GiovanniSalmeri/yellow-accordion
class YellowAccordion {
const VERSION = "0.9.1";
public $yellow; //access to API
// Handle initialisation
public function onLoad($yellow) {
$this->yellow = $yellow;
$this->yellow->system->setDefault("accordionType", "auto");
}
// Handle page extra data
public function onParsePageExtra($page, $name) {
$output = null;
if ($name == "header") {
$accordionType = $this->yellow->system->get("accordionType");
$assetLocation = $this->yellow->system->get("coreServerBase").$this->yellow->system->get("coreAssetLocation");
$output .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$assetLocation}accordion.css\" />\n";
$output .= "<script type=\"text/javascript\">var accordionType = ".json_encode($accordionType)."</script>\n";
$output .= "<script type=\"text/javascript\" defer=\"defer\" src=\"{$assetLocation}accordion.js\"></script>\n";
}
return $output;
}
}