ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUIHookProcessor.php
Go to the documentation of this file.
1<?php
2
25{
26 private bool $replaced = false;
27 protected array $append = [];
28 protected array $prepend = [];
29 protected string $replace = '';
30
31 public function __construct(
32 string $a_comp,
33 string $a_part,
34 array $a_pars
35 ) {
36 global $DIC;
37
38 $component_factory = $DIC["component.factory"];
39
40 // user interface hook [uihk]
41 foreach ($component_factory->getActivePluginsInSlot("uihk") as $plugin) {
45 $gui_class = $plugin->getUIClassInstance();
46 $resp = $gui_class->getHTML($a_comp, $a_part, $a_pars);
47
48 $mode = $resp['mode'];
49 if ($mode !== ilUIHookPluginGUI::KEEP) {
50 $html = $resp['html'];
51 switch ($mode) {
53 $this->prepend[] = $html;
54 break;
55
57 $this->append[] = $html;
58 break;
59
61 if (!$this->replaced) {
62 $this->replace = $html;
63 $this->replaced = true;
64 }
65 break;
66 }
67 }
68 }
69 }
70
71
75 public function replaced(): bool
76 {
77 return $this->replaced;
78 }
79
80 public function getHTML(string $html): string
81 {
82 if ($this->replaced) {
83 $html = $this->replace;
84 }
85 foreach ($this->append as $a) {
86 $html .= $a;
87 }
88 foreach ($this->prepend as $p) {
89 $html = $p . $html;
90 }
91
92 return $html;
93 }
94}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
global $DIC
Definition: shib_login.php:26