1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provide drush integration for print_pdf_dompdf module PDF libraries download.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* The PDF project download URL.
|
10
|
*/
|
11
|
// URI to the the latest dompdf version.
|
12
|
define('DOMPDF_DOWNLOAD_URI', 'https://api.github.com/repos/dompdf/dompdf/releases/latest');
|
13
|
|
14
|
/**
|
15
|
* Implements hook_drush_command().
|
16
|
*/
|
17
|
function print_pdf_dompdf_drush_pdf_libs_alter(&$pdf_libs) {
|
18
|
$pdf_libs['dompdf'] = array(
|
19
|
'callback' => '_print_pdf_dompdf_drush_download_url',
|
20
|
);
|
21
|
}
|
22
|
|
23
|
/**
|
24
|
* Discover the correct URL of the package to download.
|
25
|
*
|
26
|
* @return string
|
27
|
* URL of the file to download, FALSE if not known
|
28
|
*/
|
29
|
function _print_pdf_dompdf_drush_download_url() {
|
30
|
return DOMPDF_DOWNLOAD_URI;
|
31
|
}
|