ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SearchMetaBarProvider.php
Go to the documentation of this file.
1<?php
2
19declare(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}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
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...