_id = $this->get('ssID'); if (!$this->_id) { // fetch the value from the group id gid $gid = $this->get('gid'); if ($gid) { $this->_id = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $gid, 'saved_search_id'); } } } /** * Set default values for the form. */ public function setDefaultValues() { $defaults = []; $params = []; $params = ['saved_search_id' => $this->_id]; CRM_Contact_BAO_Group::retrieve($params, $defaults); if (!empty($defaults['group_type'])) { $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($defaults['group_type'], 1, -1) ); $defaults['group_type'] = array(); foreach ($types as $type) { $defaults['group_type'][$type] = 1; } } return $defaults; } }