$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if ($this->_gid) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
- CRM_Utils_System::setTitle($this->_title . ' - ' . ts('CiviCRM Profile Fields'));
+
+ $this->setPageTitle(ts('Profile Field'));
$url = CRM_Utils_System::url('civicrm/admin/uf/group/field',
"reset=1&action=browse&gid={$this->_gid}"
$defaults['field_name'] = array(
$defaults['field_type'],
($defaults['field_type'] == "Formatting" ? "" : $defaults['field_name']),
- $defaults['location_type_id'],
+ ($defaults['field_name'] == "url") ? $defaults['website_type_id'] : $defaults['location_type_id'],
CRM_Utils_Array::value('phone_type_id', $defaults),
);
$this->_gid = $defaults['uf_group_id'];
$fields = CRM_Core_BAO_UFField::getAvailableFields($this->_gid, $defaults);
- $noSearchable = array();
+ $noSearchable = $hasWebsiteTypes = array();
$addressCustomFields = array_keys(CRM_Core_BAO_CustomField::getFieldsForImport('Address'));
foreach ($fields as $key => $value) {
$this->_mapperFields[$key][$key1] = $value1['title'];
}
$hasLocationTypes[$key][$key1] = CRM_Utils_Array::value('hasLocationType', $value1);
-
+ $hasWebsiteTypes[$key][$key1] = CRM_Utils_Array::value('hasWebsiteType', $value1);
// hide the 'is searchable' field for 'File' custom data
if (isset($value1['data_type']) &&
isset($value1['html_type']) &&
$this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
+ $this->_website_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
/**
* FIXME: dirty hack to make the default option show up first. This
if ($hasLocationTypes[$k][$key]) {
$sel3[$k][$key] = $this->_location_types;
}
+ elseif ($hasWebsiteTypes[$k][$key]) {
+ $sel3[$k][$key] = $this->_website_types;
+ }
else {
$sel3[$key] = NULL;
}
);
}
- if (isset($defaults['field_name']) && CRM_Utils_Array::value(1, $defaults['field_name']) == 'url-1') {
- $defaults['field_name'][1] = 'url';
- }
-
$this->setDefaults($defaults);
}
$params['field_name'][1] = 'formatting_' . rand(1000, 9999);
}
- // temporary hack to for website
- if ($params['field_name'][1] == 'url') {
- $params['field_name'][1] = 'url-1';
- }
-
//check for duplicate fields
if ($params["field_name"][0] != "Formatting" && CRM_Core_BAO_UFField::duplicateField($params, $ids)) {
CRM_Core_Session::setStatus(ts('The selected field already exists in this profile.'), ts('Field Not Added'), 'error');
*
* @param array $fields posted values of the form
*
+ * @param $files
+ * @param $self
+ *
* @return array list of errors to be posted back to the form
* @static
* @access public