Added mail_compose_prepare hook to allow manipulation of compose dialog via other apps

This commit is contained in:
Alexandros Sigalas 2024-11-10 22:53:00 +02:00 committed by Ralf Becker
parent 7723488be1
commit 968b2ab219

View File

@ -1424,8 +1424,29 @@ class mail_compose
if (isset($content['to'])) $content['to'] = self::resolveEmailAddressList($content['to']);
$content['html_toolbar'] = empty(Mail::$mailConfig['html_toolbar']) ?
implode(',', Etemplate\Widget\HtmlArea::$toolbar_default_list) : implode(',', Mail::$mailConfig['html_toolbar']);
//Allow other apps to hook into mail_compose
$readonlys = [];
$temp = Api\Hooks::process( array(
'location' => 'mail_compose_prepare',
'content' => $content,
'readonlys' => $readonlys,
'sel_options' => $sel_options
));
foreach ($temp as $hook){
if($hook){
$content = array_merge($content, $hook['content']);
$readonlys = array_merge($readonlys,$hook['readonlys']);
$preserv = array_merge($readonlys, $hook['preserv']);
$sel_options = array_merge($readonlys, $hook['sel_options']);
}
}
unset($temp,$hook);
//error_log(__METHOD__.__LINE__.array2string($content));
$etpl->exec('mail.mail_compose.compose',$content,$sel_options,array(),$preserv,2);
$etpl->exec('mail.mail_compose.compose',$content,$sel_options,$readonlys,$preserv,2);
}
/**