ILIAS  release_7 Revision v7.30-3-g800a261c036
ModificationHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
21
22use Closure;
36
43{
45
54
58 public function __construct()
59 {
60 $this->current_page_builder = new StandardPageBuilder();
61 $this->current_page_part_provider = new StandardPagePartProvider();
62 }
63
64
65
66
67 //
68 // Modifiers
69 //
76 public function modifyPageWithClosure(Closure $closure_returning_page) : void
77 {
78 $this->current_page_builder = new DecoratedPageBuilder($this->current_page_builder, $closure_returning_page);
79 }
80
85 public function modifyContentWithClosure(Closure $closure_returning_content) : void
86 {
87 $this->replaceWithAutoWiredInstance(Legacy::class, $closure_returning_content);
88 }
89
94 public function modifyMainBarWithClosure(Closure $closure_returning_main_bar) : void
95 {
96 $this->replaceWithAutoWiredInstance(MainBar::class, $closure_returning_main_bar);
97 }
98
103 public function modifyMetaBarWithClosure(Closure $closure_returning_meta_bar) : void
104 {
105 $this->replaceWithAutoWiredInstance(MetaBar::class, $closure_returning_meta_bar);
106 }
107
112 public function modifyLogoWithClosure(Closure $closure_returning_image) : void
113 {
115 }
116
117 public function modifyResponsiveLogoWithClosure(Closure $closure_returning_image)
118 {
121 $closure_returning_image
122 );
123 }
124
129 public function modifyBreadCrumbsWithClosure(Closure $closure_returning_breadcrumbs) : void
130 {
131 $this->replaceWithAutoWiredInstance(Breadcrumbs::class, $closure_returning_breadcrumbs);
132 }
133
137 public function modifyPageBuilderWithClosure(Closure $closure_returning_page) : void
138 {
139 $this->current_page_builder = new DecoratedPageBuilder($this->current_page_builder, $closure_returning_page);
140 }
141
145 public function modifyFooterWithClosure(Closure $closure_returning_footer) : void
146 {
147 $this->replaceWithAutoWiredInstance(Footer::class, $closure_returning_footer);
148 }
149
154 {
155 return $this->current_page_builder->build($this->current_page_part_provider);
156 }
157
158 public function modifyTitleWithClosure(Closure $closure_returning_title) : void
159 {
162 $closure_returning_title
163 );
164 }
165
166 public function modifyShortTitleWithClosure(Closure $closure_returning_short_title) : void
167 {
170 $closure_returning_short_title
171 );
172 }
173
174 public function modifyViewTitleWithClosure(Closure $closure_returning_view_title) : void
175 {
178 $closure_returning_view_title
179 );
180 }
181
186 private function replaceWithAutoWiredInstance(string $interface, Closure $closure) : void
187 {
188 $this->current_page_part_provider = new DecoratedPagePartProvider($this->current_page_part_provider, $closure, $interface);
189 }
190}
An exception for terminatinating execution or to throw for unit testing.
modifyTitleWithClosure(Closure $closure_returning_title)
modifyMainBarWithClosure(Closure $closure_returning_main_bar)
modifyBreadCrumbsWithClosure(Closure $closure_returning_breadcrumbs)
replaceWithAutoWiredInstance(string $interface, Closure $closure)
modifyPageWithClosure(Closure $closure_returning_page)
modifyContentWithClosure(Closure $closure_returning_content)
modifyResponsiveLogoWithClosure(Closure $closure_returning_image)
modifyFooterWithClosure(Closure $closure_returning_footer)
modifyPageBuilderWithClosure(Closure $closure_returning_page)
modifyViewTitleWithClosure(Closure $closure_returning_view_title)
modifyMetaBarWithClosure(Closure $closure_returning_meta_bar)
modifyShortTitleWithClosure(Closure $closure_returning_short_title)
modifyLogoWithClosure(Closure $closure_returning_image)
This describes the Page.
Definition: Page.php:14
This describes the Footer.
Definition: Footer.php:16
This describes the MainBar.
Definition: MainBar.php:17
This describes the MetaBar.
Definition: MetaBar.php:15
@noinspection PhpIncompatibleReturnTypeInspection
trait SingletonTrait
Class SingletonTrait.