ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\COPage\ResourcesInjector Class Reference

Injects resources into a template. More...

+ Collaboration diagram for ILIAS\COPage\ResourcesInjector:

Public Member Functions

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

Protected Attributes

 $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 12 of file ResourcesInjector.php.

Constructor & Destructor Documentation

◆ __construct()

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

ResourcesInjector constructor.

Parameters
ResourcesCollector$collector

Definition at line 23 of file ResourcesInjector.php.

24 {
25 $this->collector = $collector;
26 }

References ILIAS\COPage\ResourcesInjector\$collector.

Member Function Documentation

◆ inject()

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

Inject into template.

Parameters
\ilGlobalTemplateInterface$tpl

Definition at line 32 of file ResourcesInjector.php.

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 }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References ILIAS\COPage\ResourcesInjector\$collector, and $tpl.

Field Documentation

◆ $collector

ILIAS\COPage\ResourcesInjector::$collector
protected

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