_action & CRM_Core_Action::DELETE) { return; } $attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_EntityRole'); $aclRoles = array('' => ts('- select -')) + CRM_Core_OptionGroup::values('acl_role'); $this->add('select', 'acl_role_id', ts('ACL Role'), $aclRoles, TRUE ); $label = ts('Assigned to'); $group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(FALSE, 'Access'); $this->add('select', 'entity_id', $label, $group, TRUE, array('class' => 'crm-select2 huge')); $this->add('checkbox', 'is_active', ts('Enabled?')); } /** * Process the form submission. * * * @return void */ public function postProcess() { CRM_ACL_BAO_Cache::resetCache(); if ($this->_action & CRM_Core_Action::DELETE) { CRM_ACL_BAO_EntityRole::del($this->_id); CRM_Core_Session::setStatus(ts('Selected Entity Role has been deleted.'), ts('Record Deleted'), 'success'); } else { $params = $this->controller->exportValues($this->_name); if ($this->_id) { $params['id'] = $this->_id; } $params['entity_table'] = 'civicrm_group'; CRM_ACL_BAO_EntityRole::create($params); } } }