👾 bug fix: cannot set TwingleProject url via TwingleForm.create API

This commit is contained in:
Marc Michalsky forumZFD 2021-04-15 20:07:48 +02:00
parent ef74a52e9f
commit c22911e886
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
4 changed files with 66 additions and 26 deletions

View file

@ -125,7 +125,9 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
/**
* ## Complement campaign values
* Complement existing campaign values with new ones
* Complement existing campaign values with new ones.
* Existing values will not get overwritten.
*
* @param array $arrayToComplement
*/
public function complement(array $arrayToComplement) {
@ -143,6 +145,27 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
}
}
/**
* ## Merge campaign values
* Merge existing campaign values with new ones.
* Existing values will be overwritten!
*
* @param array $arrayToMerge
*/
public function merge(array $arrayToMerge) {
$this->complement_r($arrayToMerge, $this->values);
}
private function merge_r($orig, &$fill) {
foreach ($orig as $key => $value) {
if (is_array($value)) {
$this->complement_r($orig[$key], $fill[$key]);
} else {
$fill[$key] = $value;
}
}
}
public static abstract function formatValues(array &$values, string $direction);
/**