3

I want to include this library into my drupal module. Now I have two problems.

  1. I wanted to use composer manager to get this library, but it's not available on packagist.org. So, I've tried to put it there manually to do not stuck on it. Path is MY_DRUPAL/vendor/malsup/jQuery.blockUI/jquery.blockUI.js

  2. I want to attach this library via hook_page_attachments, but seems I don't know how to define this library in libraries.yml. The problem is that I cannot specify path to folder vendor/ from my_module.libraries.yml, because vendor/ located in root of drupal.

Could somebody give me an advice?

Thanks in advance.

3
  • This is JS library, not PHP library. There is no reason to get /vendor directory or composer involved. Just put the js into your module's directory(or subdirectory) and define entry in libraries file of your module. – user21641 Mar 28 '16 at 21:23
  • But it's third party library. In D7 I put libraries like this, into sites/all/libraries. What the right solution for D8? – Eugene Mar 29 '16 at 4:49
  • 2
    At the moment there is no right solution: drupal.org/node/2605130 – 4k4 Mar 29 '16 at 8:05
1

You still put them in the libraries folder (now you can also use a top-level /librariesfolder).

You need the libraries module, just like in 7.x. I'm also not 100% sure how well it works now in 8.x, in the JW Player module, I'm just using it to detect the location of the files: http://cgit.drupalcode.org/jw_player/tree/jw_player.module?h=8.x-1.x#n206

1

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.