Skip to content

Commit 62cf31e

Browse files
committed
add diSemantic & diBootstrap methods for Ubiquity
1 parent 0168a5c commit 62cf31e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Ajax/php/ubiquity/JsUtils.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,38 @@ public function execJSFromFile($jsFile, $parameters = [], $immediatly = true) {
8888
}
8989
throw new \Exception(get_class() . " instance is not properly instancied : you omitted the second parameter \$controller!");
9090
}
91+
92+
/**
93+
* Returns an instance of JsUtils initialized with Semantic (for di injection)
94+
*
95+
* @param \Ubiquity\controllers\Controller $controller
96+
* @param array $options
97+
* @return \Ajax\php\ubiquity\JsUtils
98+
*/
99+
public static function diSemantic($controller, $options = [
100+
'defer' => true,
101+
'gc' => true
102+
]) {
103+
$jquery = new JsUtils($options, $controller);
104+
$jquery->semantic(new \Ajax\Semantic());
105+
$jquery->setAjaxLoader("<div class=\"ui active centered inline text loader\">Loading</div>");
106+
return $jquery;
107+
}
108+
109+
/**
110+
* Returns an instance of JsUtils initialized with Bootstrap (for di injection)
111+
*
112+
* @param \Ubiquity\controllers\Controller $controller
113+
* @param array $options
114+
* @return \Ajax\php\ubiquity\JsUtils
115+
*/
116+
public static function diBootstrap($controller, $options = [
117+
'defer' => true,
118+
'gc' => true
119+
]) {
120+
$jquery = new JsUtils($options, $controller);
121+
$jquery->bootstrap(new \Ajax\Bootstrap());
122+
$jquery->setAjaxLoader("<div class=\"ui active centered inline text loader\">Loading</div>");
123+
return $jquery;
124+
}
91125
}

0 commit comments

Comments
 (0)