ILIAS  trunk Revision v12.0_alpha-33-ge186251a14d
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;
35
37{
38 use Hasher;
39
41 {
42 return $this->context_collection->main();
43 }
44
45 public function getMainBarModification(
46 CalledContexts $screen_context_stack
49 $gui = $this->dic->help()->internal()->gui()->guidedTour()->guidedTourGUI();
50 $tm = $this->dic->help()->internal()->domain()->guidedTour()->tour();
51 $gui->init();
52 $this->globalScreen()->collector()->mainmenu()->collectOnce();
53
54 if (!$tm->anyActive()) {
55 return null;
56 }
57
58 // add id mapping of all main menu items to gui
59 foreach ($this->globalScreen()->collector()->mainmenu()->getRawItems() as $item) {
60 if ($item instanceof isDecorateable) {
61 $name = $item->getProviderIdentification()->getInternalIdentifier();
62 $item->addComponentDecorator(static function (Component $c) use ($name): ?Component {
63 return $c->withAdditionalOnLoadCode(static function (string $id) use ($name): string {
64 return "il.guidedTour.addMapping('$name', '$id');";
65 });
66 });
67 }
68 }
69 return null;
70 }
71
72 public function getMetaBarModification(CalledContexts $screen_context_stack): ?MetaBarModification
73 {
74 $tm = $this->dic->help()->internal()->domain()->guidedTour()->tour();
75 if (!$tm->anyActive()) {
76 return null;
77 }
78 // add id mapping of all main menu items to gui
79 $this->globalScreen()->collector()->metaBar()->collectOnce();
80 foreach ($this->globalScreen()->collector()->metaBar()->getRawItems() as $item) {
81 if ($item instanceof isDecorateable) {
82 $name = $item->getProviderIdentification()->getInternalIdentifier();
83 $item->addComponentDecorator(static function (Component $c) use ($name): ?Component {
84 return $c->withAdditionalOnLoadCode(static function (string $id) use ($name): string {
85 return "il.guidedTour.addMapping('$name', '$id');";
86 });
87 });
88 }
89 }
90 return null;
91 }
92}
$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.