ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
LayoutProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
36
38{
39 use Hasher;
40
42 {
43 return $this->context_collection->main();
44 }
45
46 public function getMainBarModification(
47 CalledContexts $screen_context_stack
50 $gui = $this->dic->help()->internal()->gui()->guidedTour()->guidedTourGUI();
51 $tm = $this->dic->help()->internal()->domain()->guidedTour()->tour();
52 $gui->init();
53 $this->globalScreen()->collector()->mainmenu()->collectOnce();
54
55 if (!$tm->anyActive()) {
56 return null;
57 }
58
59 // add id mapping of all main menu items to gui
60 foreach ($this->globalScreen()->collector()->mainmenu()->getRawItems() as $item) {
61 if ($item instanceof isDecorateable) {
62 $name = $item->getProviderIdentification()->getInternalIdentifier();
63 $item->addComponentDecorator(static function (Component $c) use ($name): ?Component {
64 return $c->withAdditionalOnLoadCode(static function (string $id) use ($name): string {
65 return "il.guidedTour.addMapping('$name', '$id');";
66 });
67 });
68 }
69 }
70 return null;
71 }
72
73 public function getMetaBarModification(CalledContexts $screen_context_stack): ?MetaBarModification
74 {
75 $tm = $this->dic->help()->internal()->domain()->guidedTour()->tour();
76 if (!$tm->anyActive()) {
77 return null;
78 }
79 // add id mapping of all main menu items to gui
80 $this->globalScreen()->collector()->metaBar()->collectOnce();
81 foreach ($this->globalScreen()->collector()->metaBar()->getRawItems() as $item) {
82 if ($item instanceof isDecorateable) {
83 $name = $item->getProviderIdentification()->getInternalIdentifier();
84 $item->addComponentDecorator(static function (Component $c) use ($name): ?Component {
85 return $c->withAdditionalOnLoadCode(static function (string $id) use ($name): string {
86 return "il.guidedTour.addMapping('$name', '$id');";
87 });
88 });
89 }
90 }
91 return null;
92 }
93}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getMetaBarModification(CalledContexts $screen_context_stack)
@inheritDoc
$c
Definition: deliver.php:25
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This describes a symbol.
Definition: Symbol.php:30
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.