Skip to content
Permalink
Browse files

Add social map, requires to add geolocation extra fields BT#15176

$_configuration['allow_social_map_fields'] = ['fields' => ['terms_villedustage', 'terms_ville']];
  • Loading branch information...
jmontoyaa committed Mar 6, 2019
1 parent f990b59 commit 73d802a6adb998866b2ee3fc63cc8b72509ba1c8
@@ -1137,7 +1137,6 @@ public function set_extra_fields_in_form(
}
break;
case self::FIELD_TYPE_TEXTAREA:
$form->addHtmlEditor(
'extra_'.$field_details['variable'],
$field_details['display_text'],
@@ -1698,6 +1697,13 @@ public function set_extra_fields_in_form(
$field_details['display_text'],
['id' => 'extra_'.$field_details['variable']]
);
$form->addHidden(
'extra_'.$field_details['variable'].'_coordinates',
'',
['id' => 'extra_'.$field_details['variable'].'_coordinates']
);
$form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
$form->applyFilter('extra_'.$field_details['variable'], 'trim');
if ($freezeElement) {
@@ -143,6 +143,20 @@ public function saveFieldValues($params, $onlySubmittedFields = false, $showQuer
$dirPermissions = api_get_permissions_for_new_directories();
switch ($extraFieldInfo['field_type']) {
case ExtraField::FIELD_TYPE_GEOLOCALIZATION:
if (!empty($value)) {
if (isset($params['extra_'.$extraFieldInfo['variable'].'_coordinates'])) {
$value = $value.'::'.$params['extra_'.$extraFieldInfo['variable'].'_coordinates'];
}
$newParams = [
'item_id' => $params['item_id'],
'field_id' => $extraFieldInfo['id'],
'value' => $value,
'comment' => $comment,
];
self::save($newParams, $showQuery);
}
break;
case ExtraField::FIELD_TYPE_TAG:
if ($type == EntityExtraField::USER_FIELD_TYPE) {
UserManager::delete_user_tags(
@@ -170,9 +184,7 @@ public function saveFieldValues($params, $onlySubmittedFields = false, $showQuer
foreach ($currentTags as $extraFieldtag) {
$em->remove($extraFieldtag);
}
$em->flush();
$tagValues = is_array($value) ? $value : [$value];
$tags = [];

0 comments on commit 73d802a

Please sign in to comment.
You can’t perform that action at this time.