* @access public
*/
function buildCustom($id, $name, $viewOnly = FALSE, $profileContactType = NULL, $fieldTypes = NULL) {
- $stateCountryMap = array();
-
if ($id) {
$contactID = $this->getContactID();
continue;
}
- list($prefixName, $index) = CRM_Utils_System::explode('-', $key, 2);
- if ($prefixName == 'state_province' || $prefixName == 'country' || $prefixName == 'county') {
- if (!array_key_exists($index, $stateCountryMap)) {
- $stateCountryMap[$index] = array();
- }
- $stateCountryMap[$index][$prefixName] = $key;
-
- if ($prefixName == "state_province") {
- if ($profileContactType == 'onbehalf') {
- //CRM-11881: Bypass required-ness check for state/province on Contribution Confirm page
- //as already done during Contribution registration via onBehalf's quickForm
- $field['is_required'] = FALSE;
- }
- else {
- if (count($this->_submitValues)) {
- $locationTypeId = $field['location_type_id'];
- if (array_key_exists("country-{$locationTypeId}", $fields) &&
- array_key_exists("state_province-{$locationTypeId}", $fields) &&
- !empty($this->_submitValues["country-{$locationTypeId}"])) {
- $field['is_required'] =
- CRM_Core_Payment_Form::checkRequiredStateProvince($this, "country-{$locationTypeId}");
- }
- }
- }
- }
- }
-
if ($profileContactType) {
//Since we are showing honoree name separately so we are removing it from honoree profile just for display
$honoreeNamefields = array('prefix_id', 'first_name', 'last_name', 'suffix_id', 'organization_name', 'household_name');
$this->assign($name, $fields);
- CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
-
if ($addCaptcha && !$viewOnly) {
$captcha = CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);