Superfish menu & Jquery in D8 site


I’m building , a D8 site, using theme.

One of their ‘features’ is the Superfish menu (which has been ported to D8).

However I am now finding I can’t get the Superfish menu to work, because the site can’t find the superfish library. The library is very definitely present, called “superfish” in lower-case.

I have subsequently found out that jQuery is now in Drupal core, but it’s depreciated and will be phased out for D9. I don’t know if it’s related to my problem, but it’s worth mentioning.

My problem is therefore how do I make this D8 module, on my D8 site, locate the library I have installed (as per instructions) which will make this work?

I’ve been following this:



Solution found. You’re going to love this…

The problem is that the module is looking for the libraries in a different place that the CERN architecture currently (at the time of writing, Dec 2019) allows. So we need to update the module file to look in a different place.

  1. Install all things as per instructions at

  2. Open the file /modules/superfish/superfish.module

  3. Find the code starting line 212 // Otherwise use the default directory.

  4. Add at the bottom of the elseif cycles, add the following code:

    elseif (file_exists(‘sites/’ . $_SERVER[‘HTTP_HOST’] . ‘/libraries/’ . $library)) {
    directory = 'sites/' . _SERVER[‘HTTP_HOST’] . ‘/libraries/’ . $library;

  5. Save, clear caches, and boom.

Enjoy your newly-working superfishy menus :smiley:


Yes, the problem with Drupal 8 sites is that the Libraries API is not yet stable enough,

So for the moment, either hack the module’s code to look for the library locally or ask infrastructure managers to add the library globally for all the sites.

I would like to see the libraries API ready for Drupal 8 soon, since on multisite environments is crucial.


1 Like