ILIAS  release_7 Revision v7.30-3-g800a261c036
ResourcesInjector.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5namespace ILIAS\COPage;
6
13{
17 protected $collector;
18
24 {
25 $this->collector = $collector;
26 }
27
33 {
34 $resource_collector = $this->collector;
35
36 foreach ($resource_collector->getCssFiles() as $css) {
37 $tpl->addCss($css);
38 }
39
40 foreach ($resource_collector->getJavascriptFiles() as $js) {
41 $batch = 3;
42 if (is_int(strpos($js, "jquery"))) {
43 $batch = 1;
44 }
45 if (is_int(strpos($js, "Basic.js"))) {
46 $batch = 2;
47 }
48 $tpl->addJavaScript($js, false, $batch);
49 }
50
51 foreach ($resource_collector->getOnloadCode() as $code) {
52 $tpl->addOnLoadCode($code);
53 }
54 }
55}
An exception for terminatinating execution or to throw for unit testing.
Collects all js/css/onload resources necessary for page rendering.
Injects resources into a template.
inject(\ilGlobalTemplateInterface $tpl)
Inject into template.
__construct(ResourcesCollector $collector)
ResourcesInjector constructor.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41