ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilHelpViewLayoutProvider.php
Go to the documentation of this file.
1<?php
2
11
17{
18 use \ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
19 use ilHelpDisplayed;
20
25 {
26 return $this->context_collection->main();
27 }
28
32 public function getMainBarModification(CalledContexts $called_contexts) : ?MainBarModification
33 {
34 if (!$this->showHelpTool()) {
35 return null;
36 }
37 $this->globalScreen()->collector()->mainmenu()->collectOnce();
38 foreach ($this->globalScreen()->collector()->mainmenu()->getRawItems() as $item) {
39 $p = $item->getProviderIdentification();
40
41 $tt_text = ilHelp::getMainMenuTooltip($p->getInternalIdentifier());
42 $tt_text = addslashes(str_replace(array("\n", "\r"), '', $tt_text));
43
44 if ($tt_text != "") {
45 if ($item instanceof hasSymbol && $item->hasSymbol()) {
46 $item->addSymbolDecorator(static function (Symbol $symbol) use ($tt_text) : Symbol {
47 if ($symbol instanceof JavaScriptBindable) {
48 return $symbol->withAdditionalOnLoadCode(static function ($id) use ($tt_text) : string {
49 return "il.Tooltip.addToNearest('$id', 'button,a', { context:'', my:'bottom center', at:'top center', text:'$tt_text' });";
50 });
51 }
52 return $symbol;
53 });
54 }
55 }
56 }
57
59
60 return null;
61 }
62}
An exception for terminatinating execution or to throw for unit testing.
HTML export view layout provider, hides main and meta bar.
getMainBarModification(CalledContexts $called_contexts)
No main bar in HTML exports.
static getMainMenuTooltip($a_item_id)
Get main menu tooltip.
static init()
Initializes the needed tooltip libraries.
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:33
Interface to be extended by components that have the possibility to bind to Javascript.
withAdditionalOnLoadCode(\Closure $binder)
Add some onload-code to the component instead of replacing the existing one.
This describes a symbol.
Definition: Symbol.php:12
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.