pdf_using_mpdf.install in PDF using mPDF 7
Same filename and directory in other branches
Removing all PDF set variables and checks for mPDF library existence.
File
pdf_using_mpdf.installView source
<?php
/**
* @file
* Removing all PDF set variables and checks for mPDF library existence.
*/
/**
* Implements hook_uninstall().
*/
function pdf_using_mpdf_uninstall() {
// Removing all custom varible.
db_query("DELETE FROM {variable} WHERE name LIKE 'pdf_using_mpdf_%'");
}
/**
* Implements hook_requirements().
*/
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;
}
Functions
Name | Description |
---|---|
pdf_using_mpdf_requirements | Implements hook_requirements(). |
pdf_using_mpdf_uninstall | Implements hook_uninstall(). |