public function PrintBuilder::deliverPrintable in Entity Print 8.2
Render any content entity as a Print.
Parameters
\Drupal\Core\Entity\EntityInterface[] $entities: The content entity to render.
\Drupal\entity_print\Plugin\PrintEngineInterface $print_engine: The plugin id of the Print engine to use.
bool $force_download: (optional) TRUE to try and force the document download.
bool $use_default_css: (optional) TRUE if you want the default CSS included, otherwise FALSE.
Return value
string FALSE or the Print content will be sent to the browser.
Overrides PrintBuilderInterface::deliverPrintable
File
- src/
PrintBuilder.php, line 55
Class
- PrintBuilder
- The print builder service.
Namespace
Drupal\entity_printCode
public function deliverPrintable(array $entities, PrintEngineInterface $print_engine, $force_download = FALSE, $use_default_css = TRUE) {
$renderer = $this
->prepareRenderer($entities, $print_engine, $use_default_css);
// Allow other modules to alter the generated Print object.
$this->dispatcher
->dispatch(PrintEvents::PRE_SEND, new PreSendPrintEvent($print_engine, $entities));
// Calculate the filename.
$filename = $renderer
->getFilename($entities) . '.' . $print_engine
->getExportType()
->getFileExtension();
return $print_engine
->send($filename, $force_download);
}