ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ModificationHandler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use Closure;
35 
42 {
43  use SingletonTrait;
44 
47 
51  public function __construct()
52  {
53  $this->current_page_builder = new StandardPageBuilder();
54  $this->current_page_part_provider = new StandardPagePartProvider();
55  }
56 
57 
58 
59 
60  //
61  // Modifiers
62  //
69  public function modifyPageWithClosure(Closure $closure_returning_page): void
70  {
71  $this->current_page_builder = new DecoratedPageBuilder($this->current_page_builder, $closure_returning_page);
72  }
73 
78  public function modifyContentWithClosure(Closure $closure_returning_content): void
79  {
80  $this->replaceWithAutoWiredInstance(Content::class, $closure_returning_content);
81  }
82 
87  public function modifyMainBarWithClosure(Closure $closure_returning_main_bar): void
88  {
89  $this->replaceWithAutoWiredInstance(MainBar::class, $closure_returning_main_bar);
90  }
91 
96  public function modifyMetaBarWithClosure(Closure $closure_returning_meta_bar): void
97  {
98  $this->replaceWithAutoWiredInstance(MetaBar::class, $closure_returning_meta_bar);
99  }
100 
105  public function modifyLogoWithClosure(Closure $closure_returning_image): void
106  {
108  }
109 
110  public function modifyResponsiveLogoWithClosure(Closure $closure_returning_image): void
111  {
114  $closure_returning_image
115  );
116  }
117 
122  public function modifyBreadCrumbsWithClosure(Closure $closure_returning_breadcrumbs): void
123  {
124  $this->replaceWithAutoWiredInstance(Breadcrumbs::class, $closure_returning_breadcrumbs);
125  }
126 
130  public function modifyPageBuilderWithClosure(Closure $closure_returning_page): void
131  {
132  $this->current_page_builder = new DecoratedPageBuilder($this->current_page_builder, $closure_returning_page);
133  }
134 
138  public function modifyFooterWithClosure(Closure $closure_returning_footer): void
139  {
140  $this->replaceWithAutoWiredInstance(Footer::class, $closure_returning_footer);
141  }
142 
147  {
148  return $this->current_page_builder->build($this->current_page_part_provider);
149  }
150 
151  public function modifyTitleWithClosure(Closure $closure_returning_title): void
152  {
155  $closure_returning_title
156  );
157  }
158 
159  public function modifyShortTitleWithClosure(Closure $closure_returning_short_title): void
160  {
163  $closure_returning_short_title
164  );
165  }
166 
167  public function modifyViewTitleWithClosure(Closure $closure_returning_view_title): void
168  {
171  $closure_returning_view_title
172  );
173  }
174 
179  private function replaceWithAutoWiredInstance(string $interface, Closure $closure): void
180  {
181  $this->current_page_part_provider = new DecoratedPagePartProvider($this->current_page_part_provider, $closure, $interface);
182  }
183 }
modifyContentWithClosure(Closure $closure_returning_content)
modifyShortTitleWithClosure(Closure $closure_returning_short_title)
modifyMetaBarWithClosure(Closure $closure_returning_meta_bar)
modifyPageBuilderWithClosure(Closure $closure_returning_page)
modifyTitleWithClosure(Closure $closure_returning_title)
modifyFooterWithClosure(Closure $closure_returning_footer)
modifyViewTitleWithClosure(Closure $closure_returning_view_title)
replaceWithAutoWiredInstance(string $interface, Closure $closure)
trait SingletonTrait
Class SingletonTrait.
PhpIncompatibleReturnTypeInspection
modifyResponsiveLogoWithClosure(Closure $closure_returning_image)
StandardPagePartProvider DecoratedPagePartProvider $current_page_part_provider
StandardPageBuilder DecoratedPageBuilder $current_page_builder
This describes the Page.
Definition: Page.php:30
modifyBreadCrumbsWithClosure(Closure $closure_returning_breadcrumbs)
modifyPageWithClosure(Closure $closure_returning_page)
modifyMainBarWithClosure(Closure $closure_returning_main_bar)
modifyLogoWithClosure(Closure $closure_returning_image)