88/** A layout using Mmenu */
99class MmenuLayout extends DefaultLayout {
1010
11+ protected $ hasMenu ;
12+ protected $ menu ;
1113 protected $ menuStyles ;
1214 protected $ staticMenuConfig ;
1315 protected $ menuOptions ;
1416 protected $ menuConfig ;
17+ protected $ cssPath ;
18+ protected $ jsPath ;
1519
1620 public function __construct ($ theme , $ page ) {
1721 parent ::__construct ($ theme , $ page );
@@ -21,12 +25,26 @@ public function __construct($theme, $page) {
2125 $ this ->staticMenuConfig = array ();
2226 $ this ->menuOptions = NULL ;
2327 $ this ->menuConfig = NULL ;
28+ $ this ->cssPath = NULL ;
29+ $ this ->jsPath = NULL ;
30+ }
31+
32+ public function setCssPath ($ path ) {
33+ $ this ->cssPath = $ path ;
34+ return $ this ;
35+ }
36+
37+ public function getCssPath () {
38+ $ path = $ this ->cssPath ;
39+ if ($ path == NULL ) {
40+ $ path = Utils::getWebRootPath (TRUE ).'/mmenu/mmenu.css ' ;
41+ }
42+ return $ path ;
2443 }
2544
2645 protected function renderLinks () {
27- $ webroot = Utils::getWebRootPath (TRUE );
2846 $ rc = parent ::renderLinks ();
29- $ rc .= '<link rel="stylesheet" href=" ' .$ webroot . ' /mmenu/mmenu.css " type="text/css"> ' ;
47+ $ rc .= '<link rel="stylesheet" href=" ' .$ this -> getCssPath (). ' " type="text/css"> ' ;
3048 return $ rc ;
3149 }
3250
@@ -137,10 +155,23 @@ protected function renderMenuItem($item, $level) {
137155 return $ rc ;
138156 }
139157
158+ public function setJsPath ($ path ) {
159+ $ this ->jsPath = $ path ;
160+ return $ this ;
161+ }
162+
163+ public function getJsPath () {
164+ $ path = $ this ->jsPath ;
165+ if ($ path == NULL ) {
166+ $ path = Utils::getWebRootPath (TRUE ).'/mmenu/mmenu.js ' ;
167+ }
168+ return $ path ;
169+ }
170+
140171 protected function renderJavascript () {
141172 $ rc = parent ::renderJavascript ();
142173 if ($ this ->hasMenu ) {
143- $ rc .= '<script src=" ' .Utils:: getWebRootPath ( TRUE ).'/mmenu/mmenu.js "></script> ' .
174+ $ rc .= '<script src=" ' .$ this -> getJsPath ( ).'"></script> ' .
144175 $ this ->renderMenuStyles ().
145176 '<script type="text/javascript"> ' .
146177 $ this ->renderStaticMenuConfig ().
0 commit comments