ILIAS
trunk Revision v11.0_alpha-3011-gc6b235a2e85
◀ ilDoc Overview
trait.ilMMCloseOnClick.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
use
ILIAS\UI\Component\Component
;
22
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem
;
23
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isParent
;
24
use
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isInterchangeableItem
;
25
use
ILIAS\UI\Component\Link\Link
;
26
31
trait ilMMCloseOnClick
32
{
33
protected
function
addDisengageDecorator(
isItem
$item):
isItem
34
{
35
if
(($item instanceof
isParent
|| $item instanceof
isInterchangeableItem
) && $item->getParent()->serialize() ===
''
) {
36
// always close MainBar when a link has been clicked
37
return
$item->addComponentDecorator(
static
function
(
38
Component
$c
39
):
Component
{
40
if
(!
$c
instanceof
Link
) {
41
return
$c
->withAdditionalOnLoadCode(fn(
$id
):
string
=>
"$('#$id').click(function() {
42
il.UI.maincontrols.mainbar.disengageAll();
43
il.UI.maincontrols.mainbar.clearStates();
44
})"
);
45
}
46
return
$c
;
47
});
48
}
49
50
return
$item;
51
}
52
}
$id
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition:
plugin.php:23
$c
$c
Definition:
deliver.php:25
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isInterchangeableItem
Definition:
isInterchangeableItem.php:29
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem
Interface IFactory.
Definition:
isItem.php:32
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isParent
Interface isParent.
Definition:
isParent.php:28
ILIAS\UI\Component\Component
A component is the most general form of an entity in the UI.
Definition:
Component.php:28
ILIAS\UI\Component\Link\Link
Link base interface.
Definition:
Link.php:33
ILIAS\UI\Component
components
ILIAS
MainMenu
classes
TypeRenderer
trait.ilMMCloseOnClick.php
Generated on Sun Oct 19 2025 23:03:16 for ILIAS by
1.9.4 (using
Doxyfile
)