39 array $searchModules = []
41 $this->_searchModules = $searchModules;
42 parent::__construct($context);
55 if (!$this->_authorization->isAllowed(
'Magento_Backend::global_search')) {
58 'type' =>
__(
'Error'),
59 'name' =>
__(
'Access Denied.'),
60 'description' =>
__(
'You need more permissions to do this.'),
63 if (empty($this->_searchModules)) {
66 'type' =>
__(
'Error'),
67 'name' =>
__(
'No search modules were registered'),
69 'Please make sure that all global admin search modules are installed and activated.' 74 $limit = $this->
getRequest()->getParam(
'limit', 10);
76 foreach ($this->_searchModules as $searchConfig) {
77 if ($searchConfig[
'acl'] && !$this->_authorization->isAllowed($searchConfig[
'acl'])) {
85 $searchInstance = $this->_objectManager->create(
$className);
86 $results = $searchInstance->setStart(
92 )->load()->getResults();
99 $resultJson = $this->resultJsonFactory->create();
100 return $resultJson->setData(
$items);
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, array $searchModules=[])