function pdf_using_mpdf_requirements in PDF using mPDF 8
Same name and namespace in other branches
- 8.2 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
- 7.2 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
- 7 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
Implements hook_requirements().
File
- ./
pdf_using_mpdf.install, line 15
Code
function pdf_using_mpdf_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
if (!class_exists('\\Mpdf\\Mpdf')) {
$requirements = [
'pdf_using_mpdf' => [
'title' => t('Mpdf library'),
'value' => t(': Not Found'),
'description' => t('Check if Mpdf library exists'),
'severity' => REQUIREMENT_ERROR,
],
];
}
}
if ($phase == 'runtime') {
if (class_exists('\\Mpdf\\Mpdf')) {
$mpdf = new Mpdf();
$requirements = [
'pdf_using_mpdf' => [
'title' => t('Mpdf library'),
'value' => 'Installed version: ' . $mpdf->pdf_version,
'description' => t('Mpdf library is installed'),
'severity' => REQUIREMENT_INFO,
],
];
}
else {
drupal_set_message(t('Mpdf library not found.'), 'error');
}
}
return $requirements;
}