function _print_pdf_tools in Printer, email and PDF versions 7
Same name and namespace in other branches
- 5.4 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
- 5.3 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
- 6 print_pdf/print_pdf.admin.inc \_print_pdf_tools()
- 5.x print_pdf/print_pdf.admin.inc \_print_pdf_tools()
Auxiliary function to locate suitable PDF generation tools
Return value
array of filenames with the include-able PHP file of the located tools
1 call to _print_pdf_tools()
- print_pdf_settings in print_pdf/
print_pdf.admin.inc - Menu callback for the PDF version module settings form.
File
- print_pdf/
print_pdf.admin.inc, line 288 - Contains the administrative functions of the PDF version module.
Code
function _print_pdf_tools() {
$pattern = '!^(?:dompdf_config.inc.php|tcpdf.php|wkhtmltopdf.*)$!';
$tools = array_keys(file_scan_directory(drupal_get_path('module', 'print'), $pattern));
$tools = array_merge($tools, array_keys(file_scan_directory(PRINT_PDF_LIB_PATH, $pattern)));
if (module_exists('libraries')) {
$tools = array_merge($tools, array_keys(file_scan_directory(libraries_get_path('dompdf'), '/^dompdf_config.inc.php$/')));
$tools = array_merge($tools, array_keys(file_scan_directory(libraries_get_path('tcpdf'), '/^tcpdf.php$/')));
$tools = array_merge($tools, array_keys(file_scan_directory(libraries_get_path('wkhtmltopdf'), '/^wkhtmltopdf/')));
}
$num_tools = count($tools);
if ($num_tools == 0) {
variable_set('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
return -1;
}
else {
return array_combine($tools, $tools);
}
}