public function install() { if (array_key_exists($this->ext->key, $this->customReports)) { CRM_Core_Error::fatal('This report is already registered.'); } if ($this->ext->typeInfo['component'] === 'Contact') { $compId = 'null'; } else { $comp = CRM_Core_Component::get($this->ext->typeInfo['component']); $compId = $comp->componentID; } if (empty($compId)) { CRM_Core_Error::fatal("Component for which you're trying to install the extension (" . $this->ext->typeInfo['component'] . ") is currently disabled."); } $weight = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', array('option_group_id' => $this->groupId)); $ids = array(); $params = array('label' => $this->ext->label . ' (' . $this->ext->key . ')', 'value' => $this->ext->typeInfo['reportUrl'], 'name' => $this->ext->key, 'weight' => $weight, 'description' => $this->ext->label . ' (' . $this->ext->key . ')', 'component_id' => $compId, 'option_group_id' => $this->groupId, 'is_active' => 1); $optionValue = CRM_Core_BAO_OptionValue::add($params, $ids); }