Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following lists tcpdf as a library, but it says not detected even though it is present in the libraries folder. I tried using the same code as the mailchimp module (which is correctly detected). What am I doing wrong?
function my_module_libraries_info() {
$libraries['tcpdf'] = array(
'name' => 'TCPDF',
'vendor url' => 'http://www.tcpdf.org',
'download url' => 'http://sourceforge.net/projects/tcpdf/files/',
'version arguments' => array(
'file' => 'tcpdf.php',
'pattern' => '/\Version : \"((\d+)\.(\d+)\.(\d+))\"/',
),
'files' => array(
'php' => array(
'tcpdf.php',
),
),
);
}
Comments
Comment #1
tstoecklerSo first of all, you have to actually return the library information, but since apparently you're library information is being found, I am assuming that you are doing that.
What seems to be happening is that the regular expression doesn't match the line. I looked at the latest version of tcpds and the version is declared in the following line:
I didn't actually spend a lot of time investigating the problem, but it seems like the problem *may* be that the double quotes (") in your regular expression are wrong. I don't see any double quotes in the actual line.
On an unrelated note: I would suggest you use the 'line' parameter as well, to limit the version scanning to ~10 lines. Currently libraries_get_version() will scan the entire file.
Comment #2
lsolesen CreditAttribution: lsolesen commentedThat was it.