diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 4d77346c83..d43c9c8471 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -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); } /**