ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilUIHookProcessor.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12
16 private $replaced = false;
20 protected $plugin_admin;
24 protected $append = [];
28 protected $prepend = [];
32 protected $replace = '';
33
34
42 public function __construct($a_comp, $a_part, $a_pars)
43 {
44 global $DIC;
45
46 $this->plugin_admin = $DIC["ilPluginAdmin"];
47
48 // user interface hook [uihk]
49 $pl_names = ilPluginAdmin::getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
50 foreach ($pl_names as $pl) {
51 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
55 $gui_class = $ui_plugin->getUIClassInstance();
56 $resp = $gui_class->getHTML($a_comp, $a_part, $a_pars);
57
58 $mode = $resp['mode'];
59 if ($mode !== ilUIHookPluginGUI::KEEP) {
60 $html = $resp['html'];
61 switch ($mode) {
63 $this->prepend[] = $html;
64 break;
65
67 $this->append[] = $html;
68 break;
69
71 if (!$this->replaced) {
72 $this->replace = $html;
73 $this->replaced = true;
74 }
75 break;
76 }
77 }
78 }
79 }
80
81
85 public function replaced()
86 {
87 return $this->replaced;
88 }
89
90
96 public function getHTML($html)
97 {
98 if ($this->replaced) {
99 $html = $this->replace;
100 }
101 foreach ($this->append as $a) {
102 $html .= $a;
103 }
104 foreach ($this->prepend as $p) {
105 $html = $p . $html;
106 }
107
108 return $html;
109 }
110}
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
static getActivePluginsForSlot($a_ctype, $a_cname, $a_slot_id)
Get all active plugins for a slot.
Class ilUIHookProcessor.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples