cssParser = $cssParser; $this->htmlBeforeContent = ''; $this->htmlAfterContent = ''; $this->renderer = $renderer; $this->shortcodes = $shortcodes; } public function render(NewsletterEntity $newsletter, ?string $subject = null) { $renderedNewsletter = $this->renderer->renderAsPreview($newsletter, 'html', $subject); $headingText = $subject ?? ''; $renderedHtml = $this->processShortcodes($newsletter, $renderedNewsletter); $renderedHtml = str_replace(ContentPreprocessor::WC_HEADING_PLACEHOLDER, $headingText, $renderedHtml); $html = explode(ContentPreprocessor::WC_CONTENT_PLACEHOLDER, $renderedHtml); $this->htmlBeforeContent = $html[0]; $this->htmlAfterContent = $html[1]; } public function getHTMLBeforeContent() { if (empty($this->htmlBeforeContent)) { throw new \Exception("You should call 'render' before 'getHTMLBeforeContent'"); } return $this->htmlBeforeContent . '
'; } public function getHTMLAfterContent() { if (empty($this->htmlAfterContent)) { throw new \Exception("You should call 'render' before 'getHTMLAfterContent'"); } return ' |