You are here

protected function EmailHandler::renderInNewContext in Easy Email 8

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

Parameters

array $build:

Return value

string

File

src/Service/EmailHandler.php, line 425

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);
  });
}