ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\COPage\ResourcesInjector Class Reference

Injects resources into a template. More...

+ Collaboration diagram for ILIAS\COPage\ResourcesInjector:

Public Member Functions

 __construct (ResourcesCollector $collector)
 
 inject (\ilGlobalTemplateInterface $tpl)
 Inject into template. More...
 

Protected Attributes

ResourcesCollector $collector
 

Detailed Description

Injects resources into a template.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file ResourcesInjector.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\ResourcesInjector::__construct ( ResourcesCollector  $collector)

Definition at line 30 of file ResourcesInjector.php.

31 {
32 $this->collector = $collector;
33 }

References ILIAS\COPage\ResourcesInjector\$collector.

Member Function Documentation

◆ inject()

ILIAS\COPage\ResourcesInjector::inject ( \ilGlobalTemplateInterface  $tpl)

Inject into template.

Definition at line 38 of file ResourcesInjector.php.

38 : 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 }

References ILIAS\COPage\ResourcesInjector\$collector, ILIAS\UICore\GlobalTemplate\addCss(), ILIAS\UICore\GlobalTemplate\addJavaScript(), and ILIAS\UICore\GlobalTemplate\addOnLoadCode().

+ Here is the call graph for this function:

Field Documentation

◆ $collector

ResourcesCollector ILIAS\COPage\ResourcesInjector::$collector
protected

The documentation for this class was generated from the following file: