0

I wish to use phpFlickr 3rd-party php library in developing my own custom module.

I considered Libraries API to centrally manage phpFlickr in sites/all/libraries but have some questions:

  • What happens if there are other contrib modules that also use phpFlickr and manage it through Libraries API? If my module registers phpFlickr with Libraries API then would there not be a duplicate entry with Libraries API? Does it know if more than one module wants to use it?

  • In general, how can I check for a minimum version of a library? with hook_libraries_info() a regular expression can be used to find the version, but there doesn't seem to be an explanation as to how to check for a minimum version.

I've already looked at the documentation for Libraries API and found it to be insufficient regarding examples ( https://www.drupal.org/node/1342238 ). I also looked at a page stating contrib modules that apparently used Libraries API ( https://www.drupal.org/node/1570568 ) but when I examined the code, it didn't seem to be the case, i.e. in the twitter module, I looked for "_libraries_info" but could not find it.

0

I think the answer would be to check for an API module that wraps the 3rd-party code inside a Drupal module, in my case this would be the Flickr API module, which has been fixed to use Libraries API:

https://www.drupal.org/node/2301991

If there isn't a wrapper for the 3rd-party code, then this would be the case to make one, by oneself.

0

This is the use case of libraries, if there is the library phpFlickr the in path that the libraries module search(/libraries, /sites/all/libraries) for example, you can use it, so the user do not need to add a new phpFlickr somewhere else.

As for minimum version, you can use the function version_compare() from php.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.