public function PdfGeneratorBase::displayErrors in PDF generator API 8
Same name and namespace in other branches
- 2.x src/Plugin/PdfGeneratorBase.php \Drupal\pdf_api\Plugin\PdfGeneratorBase::displayErrors()
Display error messages.
Return value
boolean Whether any errors occurred and were not ignored.
Overrides PdfGeneratorInterface::displayErrors
File
- src/
Plugin/ PdfGeneratorBase.php, line 237 - Contains \Drupal\printable\Plugin\PrintableFormatBase.
Class
- PdfGeneratorBase
- Provides a base class for PDF generator plugins.
Namespace
Drupal\pdf_api\PluginCode
public function displayErrors() {
$error = $this
->getStderr();
if ($error && !$this->generator->ignoreWarnings) {
// Add stdOut contents - they might help.
$output = $this
->getStdout();
if ($output) {
$output = str_replace("\n", "<br />", $output);
$markup = new TranslatableMarkup('@error<br />Output was:<br />@output', [
'@error' => $error,
'@output' => new FormattableMarkup($output, []),
]);
}
else {
$markup = $error;
}
$this->messenger
->addError($markup);
return true;
}
return false;
}