translate values in two directions
This commit is contained in:
parent
cbca983d8b
commit
a05b671f90
1 changed files with 27 additions and 12 deletions
|
@ -199,22 +199,37 @@ class TwingleProject {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function translateValues() {
|
private function translateValues($rev = FALSE) {
|
||||||
$values = [];
|
$values = [];
|
||||||
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
if (!$rev) {
|
||||||
if (array_key_exists(
|
foreach (TwingleProject::$customFieldMapping as $field => $custom) {
|
||||||
str_replace('twingle_project_', '', $field),
|
if (array_key_exists(
|
||||||
$this->values)
|
str_replace('twingle_project_', '', $field),
|
||||||
) {
|
$this->values)
|
||||||
$values[$custom] = $this->values[str_replace(
|
) {
|
||||||
'twingle_project_',
|
$values[$custom] = $this->values[str_replace(
|
||||||
'',
|
'twingle_project_',
|
||||||
$field)];
|
'',
|
||||||
|
$field
|
||||||
|
)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add necessary attributes
|
else {
|
||||||
$values['title'] = $this->values['name'];
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue