protected function GeneratePdf::checkContentTypeEnabled in PDF using mPDF 8
Checks if current node is enabled for viewing in PDF.
Return value
bool True if content type enabled, false otherwise.
1 call to GeneratePdf::checkContentTypeEnabled()
- GeneratePdf::checkAccess in src/
Controller/ GeneratePdf.php - Checks if current user has access to view PDF.
File
- src/
Controller/ GeneratePdf.php, line 106
Class
- GeneratePdf
- Class GeneratePdf.
Namespace
Drupal\pdf_using_mpdf\ControllerCode
protected function checkContentTypeEnabled() {
$node = \Drupal::routeMatch()
->getParameter('node');
if ($node instanceof NodeInterface) {
$config = $this->configFactory
->getEditable('pdf_using_mpdf.settings')
->get('pdf_using_mpdf');
if (in_array($node
->getType(), $config['enabled_content_types'])) {
return TRUE;
}
}
return FALSE;
}