ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
trait.ilMMCloseOnClick.php
Go to the documentation of this file.
1 <?php
18 declare(strict_types=1);
19 
25 
30 trait ilMMCloseOnClick
31 {
32  protected function addDisengageDecorator(isItem $item): isItem
33  {
34  if (($item instanceof isParent || $item instanceof isInterchangeableItem) && $item->getParent()->serialize() === '') {
35  // always close MainBar when a link has been clicked
36  return $item->addComponentDecorator(static function (
38  ): Component {
39  if (!$c instanceof Link) {
40  return $c->withAdditionalOnLoadCode(fn($id): string => "$('#$id').click(function() {
41  il.UI.maincontrols.mainbar.disengageAll();
42  il.UI.maincontrols.mainbar.clearStates();
43  })");
44  }
45  return $c;
46  });
47  }
48 
49  return $item;
50  }
51 }
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