ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilResourceRegistry.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
25 
31 {
33 
34  public function __construct(ilGlobalTemplateInterface $il_template)
35  {
36  $this->il_template = $il_template;
37  }
38 
42  public function register(string $name): void
43  {
44  $path_parts = pathinfo($name);
45  switch ($path_parts["extension"]) {
46  case "js":
47  $this->il_template->addJavaScript($name, true, 1);
48  break;
49  case "css":
50  $this->il_template->addCss($name);
51  break;
52  case "less":
53  // Can be ignored, should be compiled into css
54  break;
55  default:
56  throw new InvalidArgumentException("Can't handle resource '$name'");
57  }
58  }
59 }
Registry for resources required by rendered output like Javascript or CSS.
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilGlobalTemplateInterface $il_template)