How can specific module libraries be installed?

Hello! Currently I am working on a test site for CERN use. I had installed an external module “Superfish” but the module does not work properly because of some missing libraries: please see the attached error information.

I am unable to install the libraries from https://www.drupal.org/project/superfish which I believe should be done by someone with rights to Drupal 8.0 infrastructure at CERN. Please let me know how I can get these libraries installed so that the Superfish module works ok for my site. Thank you.

Hi

You can install the libraries using Ludwig which is provided by Drupal infrastructure.

Have a look at this post https://drupal-tools.web.cern.ch/docs/how/use-external-libraries

Hello,

Thank you for your reply. I ran into a bit more fundamental problem when I tried to use Ludwig. I do not know how I can create/place a file in https://.web.cern.ch/_webdav. I can see files, even copy/save to my local drive, but could not add a file.

My online search has not yielded much and this page http://information-technology.web.cern.ch/services/fe/drupal-infrastructure/howto/access-drupal-files-webdav looks outdated.

I need to add my ludwig.json file to my module’s folder. Could you hint me how I can do that? Thanks a lot.

Hi

You need first to mount the filesystem of your website using the link https://.web.cern.ch/_webdav

In Windows, Right click on my computer and select map network drive.

In MAC, Finder->Go->Connect to server

Hello,

         I mounted the file system and was able to create the file 'ludwig.json' (screenshot attached) with appropriate syntax. As expected, in Reports>>Packages I could see the folder location/path where I can copy missing library files to (screenshot attached). So I created the folder structure and placed my extracted library files. After clearing the cache (Configuration>>Performance(under Development)>>Clear all caches), I still see no libraries installed with the same error in the status reports and packages. I tried several times checking the syntax and redoing everything, but nothing changed.

Could you point me where the problem could be? Thank you!

Hi

I just noticed that superfish library is in JS and I am not sure Ludwig covers this case.

Maybe you can load this library from within your theme.

In order to do that you need to have a local version of your theme and not use the one provided by the infrastruture. I see that you use Bartik.

Bartik theme is included in Drupal. Download Drupal version 8.8.4

Copy the Bartik theme under the core/themes folder into your websites theme folder. Clear the caches.

Then add the Superfish js library within Bartik theme and add a line to load the file within the bartik.libraries.yml file. Save and clear caches.

If this solution doesn’t work you can open a ticket to Drupal infrastructure and ask them if they can add the Superfish library.

Hello,

      Based on my understanding, I have copied the 'bartik' theme folder from Drupal package to the 'themes' folder of my website, which otherwise was empty. Then I copied the 'superfish.js' file to themes>>batrik folder. If I understand correctly, the loading of 'superfish.js' should be specified in the bartik.libraries.yml file and simply having the .js file in the folder is not enough. However, it appears that I need to specify at a particular location and with an appropriate syntax, before saving and clearing the caches.

     I hope you could comment on where I can add the line in bartik.libraries.yml file to load the .js file. When I open this file, I see the attached format. Could you give me a syntax of the new line to be added?

Thanks again.

Hi

Inside bartik folder create a js folder and move superfish there.
Then add in bartik.libraries.yml the lines to load the JS. For example:

layout:
  css/layout.css: {}
theme:
  css/colors.css: {}
  css/print.css: { media: print }
js:
  js/superfish/files.js: {}

Add it under the theme part. Be careful with the indentation in yml files.
You might need to load all the js files from the superfish folder and also the css.

Give it a try. I hope this works for you.

Hello, surprisingly it works. However, the error message still appears in the status report. I suppose that this error is for the missing Superfish library in the CERN Drupal infrastructure, which is bypassed now. Thanks a lot again!

That’s normal because it’s not a proper installation but merely a workaround to load the libraries. Don’t worry about the error.

I am glad that it worked :slight_smile: