ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SearchMetaBarProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 
36 {
40  private function getId(): IdentificationInterface
41  {
42  return $this->if->identifier('search');
43  }
44 
45 
49  public function getAllIdentifications(): array
50  {
51  return [$this->getId()];
52  }
53 
54 
58  public function getMetaBarItems(): array
59  {
60  $content = function () {
61  $main_search = new ilMainMenuSearchGUI();
62  $html = "";
63 
64  // user interface plugin slot + default rendering
65  $uip = new ilUIHookProcessor(
66  "components/ILIAS/MainMenu",
67  "main_menu_search",
68  array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)
69  );
70  if (!$uip->replaced()) {
71  $html = $main_search->getHTML();
72  }
73 
74  return $this->dic->ui()->factory()->legacy()->content($uip->getHTML($html))->withAdditionalOnLoadCode(
75  fn($id) => 'il.SearchMainMenu.init()'
76  );
77  };
78 
79  $mb = $this->globalScreen()->metaBar();
80 
81  $item = $mb
82  ->topLegacyItem($this->getId())
83  ->withLegacyContent($content())
84  ->withSymbol($this->dic->ui()->factory()->symbol()->glyph()->search())
85  ->withTitle($this->dic->language()->txt("search"))
86  ->withPosition(2)
87  ->withAvailableCallable(
88  function () {
89  return $this->dic->rbac()->system()->checkAccess('search', ilSearchSettings::_getSearchSettingRefId());
90  }
91  );
92 
93  return [$item];
94  }
95 }
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23