function pdf_using_mpdf_requirements in PDF using mPDF 7
Same name and namespace in other branches
- 8.2 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
- 8 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
- 7.2 pdf_using_mpdf.install \pdf_using_mpdf_requirements()
Implements hook_requirements().
File
- ./
pdf_using_mpdf.install, line 19 - Removing all PDF set variables and checks for mPDF library existence.
Code
function pdf_using_mpdf_requirements($phase) {
$requirements = array();
// Ensure translations do not break at install time.
$t = get_t();
// Search for mpdf tool first.
$pattern = '/^mpdf.php$/';
// Libraries module to detect mPDF library in case of multisite installation.
$tools = array_keys(file_scan_directory(libraries_get_path('mpdf'), $pattern));
// mPDF library looked for in the module directory itself.
$tools = array_merge($tools, array_keys(file_scan_directory(drupal_get_path('module', 'pdf_using_mpdf'), $pattern)));
if (isset($tools[0])) {
$requirements['pdf_using_mpdf_library_exist'] = array(
'title' => $t('PDF using mPDF Library'),
'value' => $t('Installed'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['pdf_using_mpdf_library_exist'] = array(
'title' => $t('PDF using mPDF Library'),
'value' => $t('Not found !'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('<p>No mPDF Library Found in "sites/all/libraries" or "!default_module_path". Please download the PHP mPDF Library API from <a href="http://www.mpdf1.com/">mPDF1.com</a> </p>', array(
'!default_module_path' => drupal_get_path('module', 'pdf_using_mpdf'),
)),
);
}
return $requirements;
}