ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
trait.ilMMCloseOnClick.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
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 (
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: deliver.php:25
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23