-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModelCustomMenu.php
executable file
·44 lines (37 loc) · 1.06 KB
/
ModelCustomMenu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace WebGate\CustomMenu\Observer;
use Magento\Backend\Model\Auth\Session;
use Magento\Catalog\Ui\DataProvider\Product\ProductCollection\Interceptor;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use WebGate\CustomMenu\Helper\Data;
class ModelCustomMenu implements ObserverInterface
{
/**
* @var Session
*/
private $authSession;
/**
* @var Data
*/
private $dataHelpar;
public function __construct(
Session $authSession,
Data $dataHelpar
) {
$this->authSession = $authSession;
$this->dataHelpar = $dataHelpar;
}
/**
* @param Observer $observer
* @return void
*/
public function execute(Observer $observer)
{
/** @var Interceptor $collection */
$collection = $observer->getEvent()->getData('webgate_custommenu_custommenu_grid_collection');
if ($this->dataHelpar->getDifferentMenuAdmin()) {
$collection->addFilter('admin_id', $this->authSession->getUser()->getId());
}
}
}