ILIAS  release_8 Revision v8.24
trait.ilMMCloseOnClick.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
9
10/******************************************************************************
11 *
12 * This file is part of ILIAS, a powerful learning management system.
13 *
14 * ILIAS is licensed with the GPL-3.0, you should have received a copy
15 * of said license along with the source code.
16 *
17 * If this is not the case or you just want to try ILIAS, you'll find
18 * us at:
19 * https://www.ilias.de
20 * https://github.com/ILIAS-eLearning
21 *
22 *****************************************************************************/
27trait ilMMCloseOnClick
28{
29 protected function addDisengageDecorator(isItem $item): isItem
30 {
31 if (($item instanceof isParent || $item instanceof isInterchangeableItem) && $item->getParent()->serialize() === '') {
32 // always close MainBar when a link has been clicked
33 return $item->addComponentDecorator(static function (
36 if ($c instanceof JavaScriptBindable) {
37 return $c->withAdditionalOnLoadCode(fn ($id) => "$('#$id').click(function() {
38 il.UI.maincontrols.mainbar.disengageAll();
39 il.UI.maincontrols.mainbar.clearStates();
40 })");
41 }
42 return $c;
43 });
44 }
45
46 return $item;
47 }
48}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$c
Definition: cli.php:38
addComponentDecorator(Closure $component_decorator)
Interface to be extended by components that have the possibility to bind to Javascript.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.