ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ 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
}
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isInterchangeableItem
Definition:
isInterchangeableItem.php:28
ILIAS\UI\Component
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem
Interface IFactory.
Definition:
isItem.php:31
Component
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS\GlobalScreen\Scope\MainMenu\Factory\isParent
Interface isParent.
Definition:
isParent.php:27
$c
$c
Definition:
deliver.php:25
Standard
ilMMCloseOnClick
Link
isItem
$id
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition:
plugin.php:23
isInterchangeableItem
isParent
components
ILIAS
MainMenu
classes
TypeRenderer
trait.ilMMCloseOnClick.php
Generated on Wed Sep 3 2025 23:03:25 for ILIAS by
1.8.13 (using
Doxyfile
)