Renderer
in package
Class Renderer
Table of Contents
- TEMPLATE_FILE = 'template-canvas.php'
- TEMPLATE_STYLES_FILE = 'template-canvas.css'
- $content_renderer : Content_Renderer
- Content renderer
- $css_inliner : Css_Inliner
- Css inliner
- $personalization_tag_placeholders : array<string|int, mixed>
- Map of placeholders to full HTML comment tags for restoration.
- $personalization_tags_registry : Personalization_Tags_Registry
- Personalization tags registry
- $templates : Templates
- Templates
- $theme_controller : Theme_Controller
- Theme controller
- __construct() : mixed
- Renderer constructor.
- render() : array<string|int, mixed>
- Renders the email template
- inline_css_styles() : string
- Inlines CSS styles into the HTML
- preserve_personalization_tags() : string
- Preserves personalization tags by replacing them with unique placeholders (not inside comments).
- render_text_version() : string
- Renders the text version of the email template.
- restore_personalization_tags() : string
- Restores personalization tags from placeholders
Constants
TEMPLATE_FILE
public
mixed
TEMPLATE_FILE
= 'template-canvas.php'
TEMPLATE_STYLES_FILE
public
mixed
TEMPLATE_STYLES_FILE
= 'template-canvas.css'
Properties
$content_renderer
Content renderer
private
Content_Renderer
$content_renderer
$css_inliner
Css inliner
private
Css_Inliner
$css_inliner
$personalization_tag_placeholders
Map of placeholders to full HTML comment tags for restoration.
private
array<string|int, mixed>
$personalization_tag_placeholders
= array()
$personalization_tags_registry
Personalization tags registry
private
Personalization_Tags_Registry
$personalization_tags_registry
$templates
Templates
private
Templates
$templates
$theme_controller
Theme controller
private
Theme_Controller
$theme_controller
Methods
__construct()
Renderer constructor.
public
__construct(Content_Renderer $content_renderer, Templates $templates, Css_Inliner $css_inliner, Theme_Controller $theme_controller, Personalization_Tags_Registry $personalization_tags_registry) : mixed
Parameters
- $content_renderer : Content_Renderer
-
Content renderer.
- $templates : Templates
-
Templates.
- $css_inliner : Css_Inliner
-
CSS Inliner.
- $theme_controller : Theme_Controller
-
Theme controller.
- $personalization_tags_registry : Personalization_Tags_Registry
-
Personalization tags registry.
Return values
mixed —render()
Renders the email template
public
render(WP_Post $post, string $subject, string $pre_header, string $language[, string $meta_robots = '' ][, string $template_slug = '' ]) : array<string|int, mixed>
Parameters
- $post : WP_Post
-
Post object.
- $subject : string
-
Email subject.
- $pre_header : string
-
An email preheader or preview text is the short snippet of text that follows the subject line in an inbox. See https://kb.mailpoet.com/article/418-preview-text.
- $language : string
-
Email language.
- $meta_robots : string = ''
-
Optional string. Can be left empty for sending, but you can provide a value (e.g. noindex, nofollow) when you want to display email html in a browser.
- $template_slug : string = ''
-
Optional block template slug used for cases when email doesn't have associated template.
Return values
array<string|int, mixed> —inline_css_styles()
Inlines CSS styles into the HTML
private
inline_css_styles(string $template) : string
Parameters
- $template : string
-
HTML template.
Return values
string —preserve_personalization_tags()
Preserves personalization tags by replacing them with unique placeholders (not inside comments).
private
preserve_personalization_tags(string $template) : string
Parameters
- $template : string
-
HTML template.
Return values
string —render_text_version()
Renders the text version of the email template.
private
render_text_version(string $template) : string
Parameters
- $template : string
-
HTML template.
Return values
string —restore_personalization_tags()
Restores personalization tags from placeholders
private
restore_personalization_tags(string $text) : string
Parameters
- $text : string
-
Text content.