#8339 added macros _customdata_json_ and _customdata_text_

This commit is contained in:
Daniel Maya 2022-03-08 16:42:19 +01:00
parent 24da0283ee
commit 860400fa9c
1 changed files with 14 additions and 1 deletions

View File

@ -4166,11 +4166,24 @@ function events_get_response_target(
}
// Parse the event custom data.
if (!empty($event['custom_data'])) {
if (empty($event['custom_data']) === false) {
$custom_data = json_decode(base64_decode($event['custom_data']));
foreach ($custom_data as $key => $value) {
$target = str_replace('_customdata_'.$key.'_', $value, $target);
}
if (strpos($target, '_customdata_json_') !== false) {
$target = str_replace('_customdata_json_', json_encode($custom_data), $target);
}
if (strpos($target, '_customdata_text_') !== false) {
$text = '';
foreach ($custom_data as $key => $value) {
$text .= $key.': '.$value.PHP_EOL;
}
$target = str_replace('_customdata_text_', $text, $target);
}
}
// This will replace the macro with the current logged user.