ILIAS  release_8 Revision v8.24
ResourcesInjector.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\COPage;
20
27{
29
31 {
32 $this->collector = $collector;
33 }
34
38 public function inject(\ilGlobalTemplateInterface $tpl): void
39 {
40 $resource_collector = $this->collector;
41
42 foreach ($resource_collector->getCssFiles() as $css) {
43 $tpl->addCss($css);
44 }
45
46 foreach ($resource_collector->getJavascriptFiles() as $js) {
47 $batch = 3;
48 if (is_int(strpos($js, "jquery"))) {
49 $batch = 1;
50 }
51 if (is_int(strpos($js, "Basic.js"))) {
52 $batch = 2;
53 }
54 $tpl->addJavaScript($js, false, $batch);
55 }
56
57 foreach ($resource_collector->getOnloadCode() as $code) {
58 $tpl->addOnLoadCode($code);
59 }
60 }
61}
Collects all js/css/onload resources necessary for page rendering.
Injects resources into a template.
inject(\ilGlobalTemplateInterface $tpl)
Inject into template.
__construct(ResourcesCollector $collector)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: PageLinker.php:19