ILIAS  release_7 Revision v7.30-3-g800a261c036
SearchMetaBarProvider.php
Go to the documentation of this file.
1<?php
2
4
11
18{
19
23 private function getId() : IdentificationInterface
24 {
25 return $this->if->identifier('search');
26 }
27
28
32 public function getAllIdentifications() : array
33 {
34 return [$this->getId()];
35 }
36
37
41 public function getMetaBarItems() : array
42 {
43 $content = function () {
44 $main_search = new ilMainMenuSearchGUI();
45 $html = "";
46
47 // user interface plugin slot + default rendering
48 $uip = new ilUIHookProcessor(
49 "Services/MainMenu",
50 "main_menu_search",
51 array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)
52 );
53 if (!$uip->replaced()) {
54 $html = $main_search->getHTML();
55 }
56
57 return $this->dic->ui()->factory()->legacy($uip->getHTML($html));
58 };
59
60 $mb = $this->globalScreen()->metaBar();
61
62 $item = $mb
63 ->topLegacyItem($this->getId())
64 ->withLegacyContent($content())
65 ->withSymbol($this->dic->ui()->factory()->symbol()->glyph()->search())
66 ->withTitle($this->dic->language()->txt("search"))
67 ->withPosition(1)
68 ->withAvailableCallable(
69 function () {
70 return (bool) $this->dic->rbac()->system()->checkAccess('search', ilSearchSettings::_getSearchSettingRefId());
71 }
72 );
73
74 return [$item];
75 }
76}
An exception for terminatinating execution or to throw for unit testing.
Add a search box to main menu.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
Class ilUIHookProcessor.