For example, this code is sufficient in the module:
public function hookActionAdminControllerSetMedia($params) { if($this->context->controller->controller_name == 'AdminOrders' && !Tools::getValue('id_order')) { /* array disable employee by id */ $disabledViewEmployee = array('2', '3', '4'); /* get current employee logged */ $currentEmployee = $this->context->employee->id; /* default value */ $disable = false; if (in_array($currentEmployee, $disabledViewEmployee)){ $disable = true; } /* custom javascript */ $this->context->controller->addJs('modules/'.$this->name.'/js/adminOrders.js'); /* variable for javascript */ $jsDef = array('employe_disable_view' => $disable); Media::addJsDef($jsDef); } }
And custom JavaScript ....adminOrders.js:
$(document).ready(function(){ /* params from module */ if (employe_disable_view == true){ document.querySelectorAll('.grid-view-row-link').forEach(function(el) { el.style.display = 'none'; }); } });