Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [libraries]

Use it for questions about using third-party libraries with Drupal, or the Libraries API module.

0
votes
1answer
28 views

How to use libraries function

I have the libraries module to add some libraries in my drupal site. Currently I need to use mailjet, I found some modules with some functions to talk with api but I've tested this for multiple hours ...
-2
votes
1answer
22 views

Ensure specific JS files always load last? [on hold]

(I have looked at related answers, they provide no help because they make invalid assumptions.) I'm working on a job where the front-end is component-based. I have no control over this. Some of the ...
1
vote
1answer
122 views

Why is my theme library load on every page?

I'm beginning with D8, but I work a lot with D7 and Magento. I follow the developer documentation to add a library in my theme, and I don't understand why it's loading it on every page. I only want ...
1
vote
1answer
36 views

How to inculde 3d parrty libraries into your module?

I am using the 3d party php library, and I do not know how to connect. The file structure of my project looks like following: -my_project --src ---Plugin ----Action -----MyAction.php ---libs ----...
0
votes
1answer
19 views

Loading a custom library after all other libraries got loaded

So i wan't to load a custom .js file at the very end of the page after all other .js files have been loaded. This is my library file: my_library: js: assets/js/custom.js: {} dependencies: ...
1
vote
0answers
24 views

Adding an Attribute to a Script Tag Before Src

I'm working with CloudFlare and have identified a script that needs the data-cfasync=“false” attribute applied so CF doesn't touch it. This script is defined in a library in a custom module. my-...
1
vote
2answers
96 views

drupalSettings object not showing for anonymous users. core/drupalSettings is added as a library dependency

I'm stumped on this one. I’m having an issue where the drupalSettings object is empty when not logged in. Works fine when I am authenticated. - core/drupalSettings is in theme’s *.libraries.yml file. ...
-1
votes
1answer
23 views

Load module config into Javascript from a different module

I have two Drupal modules. One is a shared module that provides a JavaScript library. The second is a module that builds a form which uses that library. Lets call them modlib and modform. They've ...
1
vote
2answers
124 views

How to use Composer to install third party libraries [duplicate]

All I thought Composer takes care of any external library a contrib module requires automatically. I tried installing one, Composer took care of all its dependency modules, but not so much with the ...
1
vote
0answers
42 views

Unable to attach third-party library to theme

I have a multi value media field on a content type and I want to display it as a slider on the node if more than one image is uploaded to that media field.I am using slick library for this purpose. ...
1
vote
2answers
39 views

Load library dynamically depending on settings

My theme has a few settings that can be adjusted, one of them is style. I want to load the libraries depending on the styles, but without writing them in the .libraries.yml function ...
0
votes
1answer
29 views

How do I load a library using xautoload and libraries?

I am trying to load the facebook SDK (drupal 7) but I am getting the error Error: Class 'Facebook\Facebook' not found in FbPageSyncProcessSubmission::fbpagesync_facebook_sdk_initialize() ( My ...
1
vote
1answer
56 views

Local vs CDN libraries and how to check for available updates

For contributed Drupal modules, you can check whether you are using the latest version release of the module or not, by using any of the available methods such as Drush, Drupal console, Composer and ...
-2
votes
1answer
47 views

TinyButStrong (and OpenTbs) library not working [closed]

Download the lib from the web, script outside of Drupal with two include_once() and it works perfectly well. But reading questions and answers here show me this is no longer an option in a Drupal 8 ...
0
votes
1answer
43 views

How to add css files based on breakpoint in library?

We have the following mytheme.breakpoints.yml file and a simple library mylibrary that is added through our mytheme. Within the mylibrary there are two libraries, one that is optimized for desktop ...
0
votes
1answer
98 views

How to load a library only once, or how to check if a library has been loaded?

I am making an asynchronous single page application in Drupal 8. So far everything is working nicely. However, it has a lot of libraries that are needed for a lot of different things, depending on ...
0
votes
0answers
10 views

What are the expected aggregated css files when there is a dependency?

We have the following setup for two libraries: mylibrary1 and mylibrary2. Additionally we have Aggregate CSS Files = true under /admin/config/development/performance. Due to Aggregate CSS Files ...
1
vote
1answer
45 views

Module Library JS Some In Header Some In Footer

I have read that Drupal 8 by default loads library-defined files into the footer. My module libraries.yml file makes use of the "header: true" property as several JS files are needed to load in the ...
0
votes
1answer
48 views

How do I load CSS files to a custom theme?

I understand this question has been asked many times. However, I still can't figure out why the CSS files of my custom Drupal 8 theme are not loading. Edited (more info): The CSS files are not being ...
3
votes
1answer
54 views

Can you override a library per environment?

In my libraries.yml file, I have something like this, being used to define "foo-bar" as a library that can be pulled in from various parts of the site: foo-bar: version: 0.0.x js: js/foo-dev....
0
votes
2answers
44 views

How to prevent dynamic library definition from being cached?

I have a use case where i want to dynamic add library , Attributes of library will vary with page. In my case the $callback will be different depending on the page. $libraries['sample.my-lib'] = [ ...
1
vote
1answer
39 views

How to load library only on one twig template?

We have a custom theme, mytheme where we have the following library for the header-fix. I have also added {{ attach_library('mytheme/header-fix') }} to only one twig template block--myblock.html.twig ...
1
vote
1answer
17 views

jQuery transition not run on anon page

I am running Drupal 8.5.5 and am running into a problem. It seems for anonymous users jQuery is not loading a library that it would when I am logged in as admin. I tried to understand why that is but ...
0
votes
0answers
59 views

How do I get the list of all CSS files?

I'm trying to understand how I can have the whole list of the CSS, JavaScript, and the others files declared with the libraries method (or added in any right way to Drupal). Earth would be a better ...
1
vote
1answer
76 views

How to load JS as the first item in head tag?

We have a custom module that has a JS library that we want to load in the <head> tag as the very first item even before all the normal Drupal JS files. All other libraries are loaded through ...
0
votes
1answer
43 views

Why is jQuery dependency not working?

I'm extending core Classy theme so I have included my JavaScript code in theme.libraries.yml file like this: js: js/blogger-list.js: {} dependencies: - core/jquery but still browser console ...
0
votes
1answer
48 views

Changing library path with hook_library_info_alter

I am having difficulties to change the library path defined by another module in *.libraries.yml via hook_library_info_alter Essentially I have one module defining a library component in its *....
0
votes
1answer
70 views

Unable to install the “H5P.Scorm.h5p” library: “The uploaded file was not a valid h5p package”

Thanks to jackrabbithanna’s help on this other question I seem to be 1/2 way to getting H5P related libraries installed in my Drupal 7.59 install. I am attempting this on macOS High Sierra under MAMP ...
2
votes
1answer
128 views

How can I install H5P SCORM libraries?

The subject says it all. I am attempting to install H5P SCORM libraries in an install of Drupal 7.59 and running into a roadblock: None of what I am reading—or understanding—is clear about how to ...
1
vote
1answer
53 views

Installing the Waypoints plugin

I’m using Drupal 8.5.4 and I have installed the Advanced CSS/JS Aggregation module. I’m trying to install the Waypoints plugin without success via the module: jQuery waypoints (still on alpha1 for D8)....
1
vote
1answer
202 views

How do you disable the CSS from a core module in Drupal 8 using libraries-override?

I'm trying to disable the CSS styles from the layout discovery module in my theme.info.yml file. I've tried several options, but I can't seem to get it to work. This is what I have now. libraries-...
0
votes
1answer
390 views

How to make css and js in library load in the footer?

We have a library slick_carousel in our mytheme.info.yml and mytheme.libraries.yml defined in our subtheme (see below). How can we make the css and js both load in the footer? Currently only the js ...
1
vote
1answer
38 views

use PHP library in Custom Controller

I have a custom module and in its controller i am using 'namespace + classname' format to included QRCode library (which is in root/vendor/). I have used composer to install library Now I am trying ...
0
votes
1answer
378 views

Attach custom css library to entity print output

I need to attach custom css library so entity_print module uses it to generate the final PDF. The goal is to get custom css effect the generated PDF at /print/pdf/node/{{NID}} I have set the PDF ...
0
votes
0answers
250 views

How to install wkhtmltopdf Libraries?

Drupal 7.59 I use Views extensively, and would like to add https://www.drupal.org/project/views_data_export_pdf module. As per the Module documentation, a prerequisite is the installation of ...
1
vote
1answer
168 views

How to attach a library to a page controller that returns a plain Symfony response?

I created a custom module with a page controller that returns a Symfony response (Symfony\Component\HttpFoundation\Response). The thing is I don't want to render my custom theme in this controller, ...
3
votes
1answer
131 views

Common Custom PHP Library: Drupal 8 and Stand-alone Shell Scripts

I have a Drupal 8 custom module that contains 5K of php in 10 classes. This code is production ready for the launch of a new website. I also have code that runs from non-drush shell scripts. One ...
0
votes
0answers
148 views

Modules cannot find vendor libraries

I am developing Drupal 8 with Commerce. I need to have UPS and Fedex shipping modules and I noticed a strange problem with vendor dependencies. I use a remote server to run the site and use Netbeans ...
4
votes
3answers
744 views

How do I include a CSS library in my custom module?

I want to include the YAMM!3 CSS library in my Drupal 8 site. To that end, I wrote a custom module following the instructions in this answer. Although that answer is in regards to a php library, I ...
1
vote
1answer
208 views

Chosen library not working

I installed chosen module and the library v1.8.3. Jquery update is 1.10 Libraries is installed and enabled as well. I get this error on the console when I try to use a select list with chosen: ...
0
votes
1answer
65 views

correct way to load JS library for custom module

I am trying to use d3.js in my module, but I am facing some issues. I have the D3 module installed in sites/all/modules/d3/ and d3.min.js installed in sites/all/libraries/d3/, and I can see the d3/...
0
votes
2answers
78 views

Drupal 8 include Third Party Library

Hi I have a third party library located in the root/librariesbut it is not called on my webpage. I was wondering using my subtheme/subtheme.theme or subtheme.libraries.yml I call it from here? Any ...
1
vote
1answer
236 views

From my child theme, how can I remove a library loaded by the parent theme?

I have hit an issue which I think is quite unusual or peculiar when settingup a child theme. A commercial parent theme I have bought loads the Slick library like this in its theme.libraries.yml: ...
0
votes
0answers
20 views

What is the recommended way to load a dev version of a library locally and production version on production on Drupal 8

For example with Vue.js on dev (local development) I would like to load the dev version like this: vue: version: VERSION js: /libraries/vue/dist/vue.js: {} dependencies: - core/jquery ...
0
votes
0answers
659 views

How to install phpoffice/phpspreadsheet with composer in Drupal 7

I need to write Excel sheet in my Drupal Project and for that I am trying to use Thrid Party PHP library named as PhpSreadSheet. But the problem is that when I am trying to install this with ...
1
vote
1answer
512 views

How to reuse object between Drupal Behaviors?

We have a JS file (basic-page.js) that has the following Drupal Behavior. In this, we created what we believe is considered a Drupal object (need help with correct term) that contains a function that ...
0
votes
1answer
301 views

How to add google_tag script to header with custom environment variables?

I'm trying to add Google Tag Manager to the <head> of my document. Unfortunately, the way I'm doing it with an HTML tag render element, the ampersands (&) are being escaped. function ...
0
votes
2answers
241 views

How can I include Google Structured Data via a module?

Looking through Google's suggestions of search optimisation for a site that I control, I would like to add their "Structured Data" JSON to various pages on the site. Their suggestion is to include the ...
0
votes
1answer
314 views

removing stylesheet from base theme

In our Drupal 8 theme we are using the classy base theme. themes/mytheme/mytheme.info.yml: base theme: classy Using the information from drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-...
1
vote
1answer
312 views

What ways to attach a library to a form?

I created a custom form and I use a js library on it. I attached my JS in my template file but in a first time, I tried to attach it directly on my form with $form['#attached']['library'][] = "...