ILIAS  release_8 Revision v8.24
DecoratedPagePartProvider.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
21
22use Closure;
30
37{
38 public const PURPOSE_TITLE = 'ptitle';
39 public const PURPOSE_SHORTTITLE = 'stitle';
40 public const PURPOSE_VIEWTITLE = 'vtitle';
41 public const PURPOSE_LOGO = 'plogo';
42 public const PURPOSE_RESPONSIVE_LOGO = 'prlogo';
43 public const PURPOSE_FAVICON = 'pfavicon';
44
46 private Closure $deco;
47 private string $purpose;
48
55 public function __construct(PagePartProvider $original, Closure $deco, string $purpose)
56 {
57 $this->original = $original;
58 $this->deco = $deco;
59 $this->purpose = $purpose;
60 }
61
62 private function getDecoratedOrOriginal(string $purpose, $original)
63 {
64 if ($this->isDecorated($purpose)) {
66
67 return $deco($original);
68 }
69
70 return $original;
71 }
72
73 private function isDecorated(string $purpose): bool
74 {
75 return $purpose === $this->purpose;
76 }
77
81 public function getContent(): ?Legacy
82 {
83 return $this->getDecoratedOrOriginal(Legacy::class, $this->original->getContent());
84 }
85
89 public function getMetaBar(): ?MetaBar
90 {
91 return $this->getDecoratedOrOriginal(MetaBar::class, $this->original->getMetaBar());
92 }
93
97 public function getMainBar(): ?MainBar
98 {
99 return $this->getDecoratedOrOriginal(MainBar::class, $this->original->getMainBar());
100 }
101
105 public function getBreadCrumbs(): ?Breadcrumbs
106 {
107 return $this->getDecoratedOrOriginal(Breadcrumbs::class, $this->original->getBreadCrumbs());
108 }
109
113 public function getLogo(): ?Image
114 {
115 return $this->getDecoratedOrOriginal(self::PURPOSE_LOGO, $this->original->getLogo());
116 }
117
118
119 public function getResponsiveLogo(): ?Image
120 {
121 return $this->getDecoratedOrOriginal(self::PURPOSE_RESPONSIVE_LOGO, $this->original->getResponsiveLogo());
122 }
123
124 public function getFaviconPath(): string
125 {
126 return $this->getDecoratedOrOriginal(self::PURPOSE_FAVICON, $this->original->getFaviconPath());
127 }
128
132 public function getSystemInfos(): array
133 {
134 return $this->original->getSystemInfos();
135 }
136
140 public function getFooter(): ?Footer
141 {
142 return $this->getDecoratedOrOriginal(Footer::class, $this->original->getFooter());
143 }
144
148 public function getTitle(): string
149 {
150 return $this->getDecoratedOrOriginal(self::PURPOSE_TITLE, $this->original->getTitle());
151 }
152
156 public function getShortTitle(): string
157 {
158 return $this->getDecoratedOrOriginal(self::PURPOSE_SHORTTITLE, $this->original->getShortTitle());
159 }
160
164 public function getViewTitle(): string
165 {
166 return $this->getDecoratedOrOriginal(self::PURPOSE_VIEWTITLE, $this->original->getViewTitle());
167 }
168
169 public function getToastContainer() : ?TContainer
170 {
171 return $this->getDecoratedOrOriginal(TContainer::class, $this->original->getToastContainer());
172 }
173}
__construct(PagePartProvider $original, Closure $deco, string $purpose)
DecoratedPagePartProvider constructor.
This describes the Footer.
Definition: Footer.php:33
This describes the MainBar.
Definition: MainBar.php:34
This describes the MetaBar.
Definition: MetaBar.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...