Skip to content
Snippets Groups Projects

Devel

Merged Piotr Potrebka requested to merge devel into main
Compare and Show latest version
11 files
+ 44
14
Compare changes
  • Side-by-side
  • Inline

Files

+ 14
3
@@ -58,6 +58,13 @@ abstract class EmailAbstract implements EmailInterface {
*/
abstract public function get_id(): string;
/**
* @return string
*/
public function get_template_name(): string {
return 'default';
}
/**
* @return string
*/
@@ -136,7 +143,7 @@ abstract class EmailAbstract implements EmailInterface {
throw new Exception( 'Empty email subject' );
}
return $this->subject;
return $this->replace_placeholders( $this->subject );
}
/**
@@ -158,7 +165,7 @@ abstract class EmailAbstract implements EmailInterface {
* @return string
*/
public function get_heading(): string {
return $this->heading;
return $this->replace_placeholders( $this->heading );
}
/**
@@ -285,7 +292,7 @@ abstract class EmailAbstract implements EmailInterface {
* @throws Exception
*/
public function get_content(): string {
return $this->content;
return $this->replace_placeholders( $this->content );
}
/**
@@ -294,6 +301,10 @@ abstract class EmailAbstract implements EmailInterface {
* @return array|string|string[]
*/
protected function replace_placeholders( string $string ): string {
if ( empty( $this->placeholders ) ) {
return $string;
}
return (string) str_replace( array_keys( $this->placeholders ), array_values( $this->placeholders ), $string );
}
Loading