Allow templating of email subjects
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
8e884ba52f
commit
f109c1a10c
|
@ -50,6 +50,8 @@ class EMailTemplate implements IEMailTemplate {
|
|||
/** @var array */
|
||||
protected $data;
|
||||
|
||||
/** @var string */
|
||||
protected $subject = '';
|
||||
/** @var string */
|
||||
protected $htmlBody = '';
|
||||
/** @var string */
|
||||
|
@ -358,6 +360,15 @@ EOF;
|
|||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the subject of the email
|
||||
*
|
||||
* @param string $subject
|
||||
*/
|
||||
public function setSubject($subject) {
|
||||
$this->subject = $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a header to the email
|
||||
*/
|
||||
|
@ -595,6 +606,15 @@ EOF;
|
|||
$this->plainBody .= str_replace('<br>', PHP_EOL, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rendered email subject as string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderSubject() {
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rendered HTML email as string
|
||||
*
|
||||
|
|
|
@ -52,6 +52,15 @@ namespace OCP\Mail;
|
|||
*/
|
||||
interface IEMailTemplate {
|
||||
|
||||
/**
|
||||
* Sets the subject of the email
|
||||
*
|
||||
* @param string $subject
|
||||
*
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function setSubject($subject);
|
||||
|
||||
/**
|
||||
* Adds a header to the email
|
||||
*
|
||||
|
@ -130,6 +139,15 @@ interface IEMailTemplate {
|
|||
*/
|
||||
public function addFooter($text = '');
|
||||
|
||||
/**
|
||||
* Returns the rendered email subject as string
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function renderSubject();
|
||||
|
||||
/**
|
||||
* Returns the rendered HTML email as string
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue