translate values in two directions

This commit is contained in:
Marc Michalsky forumZFD 2020-09-29 14:15:04 +02:00
parent cbca983d8b
commit a05b671f90
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -199,8 +199,9 @@ class TwingleProject {
* *
* @return array * @return array
*/ */
private function translateValues() { private function translateValues($rev = FALSE) {
$values = []; $values = [];
if (!$rev) {
foreach (TwingleProject::$customFieldMapping as $field => $custom) { foreach (TwingleProject::$customFieldMapping as $field => $custom) {
if (array_key_exists( if (array_key_exists(
str_replace('twingle_project_', '', $field), str_replace('twingle_project_', '', $field),
@ -209,12 +210,26 @@ class TwingleProject {
$values[$custom] = $this->values[str_replace( $values[$custom] = $this->values[str_replace(
'twingle_project_', 'twingle_project_',
'', '',
$field)]; $field
)];
} }
} }
// Add necessary attributes }
$values['title'] = $this->values['name']; else {
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
if (array_key_exists($custom, $this->values)
) {
$values[str_replace(
'twingle_project_',
'',
$field
)] = $this->values[$custom];
}
}
}
// Add necessary values
$values['campaign_type_id'] = 'twingle_project'; $values['campaign_type_id'] = 'twingle_project';
$values['title'] = $this->values['name'];
return $values; return $values;
} }