ILIAS  release_8 Revision v8.24
SearchMetaBarProvider.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
13
20{
24 private function getId(): IdentificationInterface
25 {
26 return $this->if->identifier('search');
27 }
28
29
33 public function getAllIdentifications(): array
34 {
35 return [$this->getId()];
36 }
37
38
42 public function getMetaBarItems(): array
43 {
44 $content = function () {
45 $main_search = new ilMainMenuSearchGUI();
46 $html = "";
47
48 // user interface plugin slot + default rendering
49 $uip = new ilUIHookProcessor(
50 "Services/MainMenu",
51 "main_menu_search",
52 array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)
53 );
54 if (!$uip->replaced()) {
55 $html = $main_search->getHTML();
56 }
57
58 return $this->dic->ui()->factory()->legacy($uip->getHTML($html));
59 };
60
61 $mb = $this->globalScreen()->metaBar();
62
63 $item = $mb
64 ->topLegacyItem($this->getId())
65 ->withLegacyContent($content())
66 ->withSymbol($this->dic->ui()->factory()->symbol()->glyph()->search())
67 ->withTitle($this->dic->language()->txt("search"))
68 ->withPosition(1)
69 ->withAvailableCallable(
70 function () {
71 return $this->dic->rbac()->system()->checkAccess('search', ilSearchSettings::_getSearchSettingRefId());
72 }
73 );
74
75 return [$item];
76 }
77}
Add a search box to main menu.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...