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