/** * TODO: Document this Method! ( assignVariables ) */ public function preToolbarRendering() { $account = $this->context->getAccount(); $votes = array(); $privilege = array('PRIVILEGE_ABSTAIN', 'PRIVILEGE_GRANT', 'PRIVILEGE_DENY'); $roleVotes = \Debug\Toolbar\Service\DataStorage::get('Security:RoleVotes'); if (is_array($roleVotes)) { foreach ($roleVotes as $key => $value) { $vote = array('role' => (string) $value['role']); $vote['privilege'] = ''; if (is_array($value['privileges'])) { foreach ($value['privileges'] as $k => $p) { $vote['privilege'] = $privilege[$p]; } } $votes[$value['role'] . ':' . $vote['privilege']] = $vote; } } else { $roles = $this->context->getRoles(); foreach ($roles as $key => $value) { $vote = array('role' => (string) $value); $votes[] = $vote; } } \Debug\Toolbar\Service\Collector::getModule('Security')->getToolbar()->addIcon('user')->addText(is_object($account) ? $account->getAccountIdentifier() : 'Guest')->getPopup()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes))->getPanel()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes)); }