/** * Check/do things before rendering the output. * * @param Event $event [description] * @return void */ public function beforeRender(Event $event) { $tableConfig = []; if (method_exists($this->_tableInstance, 'getConfig')) { $tableConfig = $this->_tableInstance->getConfig(); } $controller = $event->subject(); if (!empty($tableConfig) && !empty($controller->viewVars['fields']) && !empty($controller->viewVars['entity']) && $this->request->action === 'view') { $panelFields = $controller->viewVars['fields']; $entity = $controller->viewVars['entity']; $evalPanels = $this->getEvalPanels($tableConfig, $entity->toArray()); if (!empty($evalPanels['fail'])) { $controller->viewVars['fields'] = array_diff_key($panelFields, array_flip($evalPanels['fail'])); } } }