You are here

protected function PdfDownload::sendResponse in Entity Print 8

Sends the response using a stream and catches any errors.

Parameters

callable $callback: The callable responding for rendering the content.

2 calls to PdfDownload::sendResponse()
PdfDownload::execute in src/Plugin/Action/PdfDownload.php
Executes the plugin.
PdfDownload::executeMultiple in src/Plugin/Action/PdfDownload.php
Executes the plugin for an array of objects.

File

src/Plugin/Action/PdfDownload.php, line 129

Class

PdfDownload
Downloads the PDF for an entity.

Namespace

Drupal\entity_print\Plugin\Action

Code

protected function sendResponse(callable $callback) {
  try {
    (new StreamedResponse($callback))
      ->send();
  } catch (PdfEngineException $e) {
    drupal_set_message(new FormattableMarkup(Xss::filter($e
      ->getMessage()), []), 'error');
  }
}