$domain['contact_id'], ); $values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE); $address_array = array( 'street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2', ); if (!empty($values['location']['email'])) { $domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]); } if (!empty($values['location']['phone'])) { $domain['domain_phone'] = array( 'phone_type' => CRM_Core_OptionGroup::getLabel( 'phone_type', CRM_Utils_Array::value( 'phone_type_id', $values['location']['phone'][1] ) ), 'phone' => CRM_Utils_Array::value( 'phone', $values['location']['phone'][1] ), ); } if (!empty($values['location']['address'])) { foreach ($address_array as $value) { $domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1] ); } } list($domain['from_name'], $domain['from_email'] ) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); $domains[$domain['id']] = array_merge($domains[$domain['id']], $domain); } } return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao); } /** * Adjust Metadata for Get action. * * The metadata is used for setting defaults, documentation & validation. * * @param array $params * Array or parameters determined by getfields. */ function _civicrm_api3_domain_get_spec(&$params) { $params['current_domain'] = array('title' => "get loaded domain"); } /** * Create a new domain. * * @param array $params * * @return array */ function civicrm_api3_domain_create($params) { $params['version'] = $params['domain_version']; return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params); } /** * Adjust Metadata for Create action. * * The metadata is used for setting defaults, documentation & validation. * * @param array $params * Array or parameters determined by getfields. */ function _civicrm_api3_domain_create_spec(&$params) { $params['domain_version'] = $params['version']; $params['domain_version']['api.required'] = 1; unset($params['version']); $params['name']['api.required'] = 1; }