ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
DecoratedPagePartProvider.php
Go to the documentation of this file.
2 
3 use Closure;
10 
19 {
20  const PURPOSE_TITLE = 'ptitle';
21  const PURPOSE_SHORTTITLE = 'stitle';
22  const PURPOSE_VIEWTITLE = 'vtitle';
23  const PURPOSE_LOGO = 'plogo';
24  const PURPOSE_RESPONSIVE_LOGO = 'prlogo';
25 
29  private $original;
33  private $deco;
37  private $purpose = '';
38 
39 
48  {
49  $this->original = $original;
50  $this->deco = $deco;
51  $this->purpose = $purpose;
52  }
53 
54 
55  private function getDecoratedOrOriginal(string $purpose, $original)
56  {
57  if ($this->isDecorated($purpose)) {
59 
60  return $deco($original);
61  }
62 
63  return $original;
64  }
65 
66 
67  private function isDecorated(string $purpose) : bool
68  {
69  return $purpose === $this->purpose;
70  }
71 
72 
76  public function getContent() : ?Legacy
77  {
78  return $this->getDecoratedOrOriginal(Legacy::class, $this->original->getContent());
79  }
80 
81 
85  public function getMetaBar() : ?MetaBar
86  {
87  return $this->getDecoratedOrOriginal(MetaBar::class, $this->original->getMetaBar());
88  }
89 
90 
94  public function getMainBar() : ?MainBar
95  {
96  return $this->getDecoratedOrOriginal(MainBar::class, $this->original->getMainBar());
97  }
98 
99 
103  public function getBreadCrumbs() : ?Breadcrumbs
104  {
105  return $this->getDecoratedOrOriginal(Breadcrumbs::class, $this->original->getBreadCrumbs());
106  }
107 
108 
112  public function getLogo() : ?Image
113  {
114  return $this->getDecoratedOrOriginal(self::PURPOSE_LOGO, $this->original->getLogo());
115  }
116 
117 
118  public function getResponsiveLogo() : ?Image
119  {
120  return $this->getDecoratedOrOriginal(self::PURPOSE_RESPONSIVE_LOGO, $this->original->getResponsiveLogo());
121  }
122 
126  public function getFooter() : ?Footer
127  {
128  return $this->getDecoratedOrOriginal(Footer::class, $this->original->getFooter());
129  }
130 
134  public function getTitle() : string
135  {
136  return $this->getDecoratedOrOriginal(self::PURPOSE_TITLE, $this->original->getTitle());
137  }
138 
142  public function getShortTitle() : string
143  {
144  return $this->getDecoratedOrOriginal(self::PURPOSE_SHORTTITLE, $this->original->getShortTitle());
145  }
146 
150  public function getViewTitle() : string
151  {
152  return $this->getDecoratedOrOriginal(self::PURPOSE_VIEWTITLE, $this->original->getViewTitle());
153  }
154 }
This describes the MainBar.
Definition: MainBar.php:15
__construct(PagePartProvider $original, Closure $deco, string $purpose)
DecoratedPagePartProvider constructor.
This describes the MetaBar.
Definition: MetaBar.php:14
This describes the Footer.
Definition: Footer.php:11