}
$this->setDefaults($this->_defaults);
+
+ // add in all state country selectors for enabled countries
+ CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults);
}
public function buildQuickForm() {
*/
function buildCustom($id, $name, $viewOnly = FALSE) {
+ // create state country map array to hold selectors
+ $stateCountryMap = array();
+
if ($id) {
$session = CRM_Core_Session::singleton();
$this->assign("petition", $this->petition);
// ignore file upload fields
continue;
}
-
+
+ // if state or country in the profile, create map
+ 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;
+ }
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE, $contactID, TRUE);
$this->_fields[$key] = $field;
}
}
+ // initialize the state country map
+ CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
+
if ($addCaptcha &&
!$viewOnly
) {