You are here

protected function EmailHandler::renderInNewContext in Easy Email 2.0.x

Same name and namespace in other branches
  1. 8 src/Service/EmailHandler.php \Drupal\easy_email\Service\EmailHandler::renderInNewContext()

Parameters

array $build:

Return value

string

File

src/Service/EmailHandler.php, line 426

Class

EmailHandler

Namespace

Drupal\easy_email\Service

Code

protected function renderInNewContext($build, $plain_text = FALSE) {
  return $this->renderer
    ->executeInRenderContext(new RenderContext(), function () use ($build, $plain_text) {
    if ($plain_text) {
      return PlainTextOutput::renderFromHtml($this->renderer
        ->renderPlain($build));
    }
    return $this->renderer
      ->render($build);
  });
}