Skip to content
Snippets Groups Projects

Devel

Merged Piotr Potrebka requested to merge devel into main
Compare and Show latest version
10 files
+ 106
128
Compare changes
  • Side-by-side
  • Inline

Files

+ 30
3
@@ -58,6 +58,24 @@ abstract class EmailAbstract implements EmailInterface {
*/
abstract public function get_id(): string;
public function get_template_name(): string {
return 'default';
}
/**
* @return string
*/
public function get_from(): string {
return '';
}
/**
* @return string
*/
public function get_from_name(): string {
return '';
}
/**
* @return bool
*/
@@ -122,7 +140,7 @@ abstract class EmailAbstract implements EmailInterface {
throw new Exception( 'Empty email subject' );
}
return $this->subject;
return $this->replace_placeholders( $this->subject );
}
/**
@@ -144,7 +162,7 @@ abstract class EmailAbstract implements EmailInterface {
* @return string
*/
public function get_heading(): string {
return $this->heading;
return $this->replace_placeholders( $this->heading );
}
/**
@@ -271,7 +289,16 @@ abstract class EmailAbstract implements EmailInterface {
* @throws Exception
*/
public function get_content(): string {
return $this->content;
return $this->replace_placeholders( $this->content );
}
/**
* @param string $string
*
* @return array|string|string[]
*/
protected function replace_placeholders( string $string ): string {
return (string) str_replace( array_keys( $this->placeholders ), array_values( $this->placeholders ), $string );
}
Loading