-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Note: this depends on this change to core being merged: civicrm/civicrm-core#20309
- Loading branch information
1 parent
ee78a6d
commit eec4710
Showing
4 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
use CRM_Remoteform_ExtensionUtil as E; | ||
|
||
/** | ||
* RemoteForm.Countyforstateprovince API specification (optional) | ||
* This is used for documentation and validation. | ||
* | ||
* @param array $spec description of fields supported by this API call | ||
* @return void | ||
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards | ||
*/ | ||
function _civicrm_api3_remote_form_Countiesforstateprovince_spec(&$params) { | ||
$params['county_id']['title'] = 'State Province ID'; | ||
} | ||
|
||
function civicrm_api3_remote_form_Countiesforstateprovince(&$params) { | ||
$state_province_id = NULL; | ||
$values = array(); | ||
if (array_key_exists('state_province_id', $params)) { | ||
$state_province_id = $params['state_province_id']; | ||
} | ||
if (empty($state_province_id)) { | ||
$state_province_id = Civi::settings()->get('defaultContactStateProvince'); | ||
if (empty($state_province_id)) { | ||
// Rather then return all counties in the world, return nothing if no defaults. | ||
return civicrm_api3_create_success([]); | ||
} | ||
} | ||
$values = CRM_Core_PseudoConstant::countyForState($state_province_id); | ||
return civicrm_api3_create_success($values); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters