ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CustomBreadcrumbPagePartProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\Refinery\Factory as RefineryFactory;
23
25{
27 private RefineryFactory $refinery;
29
31 {
32 global $DIC;
33 $this->refinery = $DIC->refinery();
34 $this->original = $original;
35 $this->logger = $DIC->logger()->root();
36 }
37
38 public function getTitle(): string
39 {
40 return $this->original->getTitle();
41 }
42
43 public function getDescription(): string
44 {
45 return $this->original->getDescription();
46 }
47
48 private function getRefId(): string|null
49 {
50 global $DIC;
51
52 if (ilSession::has("ref_id")) {
53 return (string) ilSession::get("ref_id");
54 }
55 if (ilSession::has("lti_context_ids") && is_array(ilSession::get("lti_context_ids")) && count(ilSession::get("lti_context_ids")) > 0) {
56 return (string) ilSession::get("lti_context_ids")[0];
57 }
58
59 if ($DIC ->http()->wrapper()->query()->has("ref_id")) {
60 return $DIC ->http()->wrapper()->query()->retrieve("ref_id", $DIC->refinery()->to()->string());
61 }
62 return null;
63 }
64
65 public function getBreadCrumbs(): ?\ILIAS\UI\Component\Breadcrumbs\Breadcrumbs
66 {
67 global $DIC;
68 $breadcrumbs = $this->original->getBreadCrumbs();
69 if ($breadcrumbs === null) {
70 return null;
71 }
72
73 $ref_id = $this->getRefId();
74 if (!isset($ref_id)) {
75 return $breadcrumbs;
76 }
77
78 $goto_crumbs = [];
79 $non_goto_crumbs = [];
80
81 foreach ($breadcrumbs->getItems() as $crumb) {
82 $action = (string) $crumb->getAction();
83 if (method_exists($crumb, 'getAction') && (str_contains($action, 'goto.php') || str_contains($action, '/go/'))) {
84 if (str_contains($action, $ref_id) && !str_contains($action, 'root')) {
85 $goto_crumbs[] = $crumb;
86 }
87 } else {
88 $non_goto_crumbs[] = $crumb;
89 }
90 }
91 $last_goto = array_slice($goto_crumbs, -1);
92
93 $final_crumbs = array_merge($last_goto, $non_goto_crumbs);
94
95 return $DIC->ui()->factory()->breadcrumbs($final_crumbs);
96
97 }
98
99 public function getMeta(): array
100 {
101 return $this->original->getMeta();
102 }
103
104 public function getActions(): array
105 {
106 return $this->original->getActions();
107 }
108
109 public function getContent(): ?\ILIAS\UI\Component\Legacy\Content
110 {
111 return $this->original->getContent();
112 }
113
114 public function getMetaBar(): ?\ILIAS\UI\Component\MainControls\MetaBar
115 {
116 return $this->original->getMetaBar();
117 }
118
119 public function getMainBar(): ?\ILIAS\UI\Component\MainControls\MainBar
120 {
121 return $this->original->getMainBar();
122 }
123
124 public function getLogo(): ?\ILIAS\UI\Component\Image\Image
125 {
126 return $this->original->getLogo();
127 }
128
129 public function getResponsiveLogo(): ?\ILIAS\UI\Component\Image\Image
130 {
131 return $this->original->getResponsiveLogo();
132 }
133
134 public function getFaviconPath(): string
135 {
136 return $this->original->getFaviconPath();
137 }
138
139 public function getSystemInfos(): array
140 {
141 return $this->original->getSystemInfos();
142 }
143
144 public function getFooter(): ?\ILIAS\UI\Component\MainControls\Footer
145 {
146 return $this->original->getFooter();
147 }
148
149 public function getShortTitle(): string
150 {
151 return $this->original->getShortTitle();
152 }
153
154 public function getViewTitle(): string
155 {
156 return $this->original->getViewTitle();
157 }
158
159 public function getToastContainer(): ?\ILIAS\UI\Component\Toast\Container
160 {
161 return $this->original->getToastContainer();
162 }
163}
Builds data types.
Definition: Factory.php:36
Component logger with individual log levels by component id.
static get(string $a_var)
static has($a_var)
$ref_id
Definition: ltiauth.php:66
static http()
Fetches the global http state from ILIAS.
has(string $class_name)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26