All Questions

3
votes
1answer
739 views

Custom module library not detected

I am writing a custom module to load the crossfilter.js library in Drupal 7. I have followed what I believe are the right steps to doing that when using the Libraries module API. However when I run ...
1
vote
1answer
206 views

How can I extend a module and it's library with custom functionality?

My client requested a modification to their slider that will enable two captions. I'm using the Views Nivo Slider module and believe I can accomplish what I want by modifying the module"s code and ...
1
vote
1answer
335 views

Leaflet library not avaliable even though it's in sites/all/libraries

I've seen people talking about hook_library() etc., but I'm not creating a custom module, I'm trying to use Leaflet. In the browser I get the error message: L is not defined From leaflet.drupal.js ...
2
votes
1answer
1k views

How to position javascript file as the last one to load?

In Drupal 8 the weight for javascript files in libraries is not supported, or at least only negative values are allowed, which means I am only able to position them at the top of the list (i.e. load ...
0
votes
1answer
221 views

drupal loses track of a library (leaflet), randomly

I have an strange problem with a library (leaflet). I have some maps, and it works fine, but randomly (as far as I have been able to detect) drupal is unable to find leaflet.js and leaflet.css (it ...
1
vote
0answers
777 views

How to add multi recaptcha in a page

I have some custom form in a page ( sign/signup),first I try render them with google API instruction Paste this snippet before the closing tag on your HTML template: <script src='https://www....
0
votes
1answer
400 views

Is it possible to include external libraries in a twig template?

I think I know the answer, because I tried to attach an external library like this: {% set location = {'type': 'external'} %} {{ attach_library('//example.com/example.js/v3/example.js', location) }} ...
2
votes
2answers
759 views

How to create an Orbit slide show based on the zurb foundation?

I stubbornly tried to create an Orbit slide show based on zurb foundation 6 framework. I followed all the steps on the instruction page:Orbit Slide Show. I added everything needed for this type of ...
1
vote
1answer
2k views

jQuery error in a theme

I'm trying to run a jquery script for my Drupal 8 site, but in the error console, I get a TypeError: $ is not a function. I know this usually happens when jQuery isn't loaded, but the jquery.min.js is ...
0
votes
1answer
43 views

Stuck developing a new library module for “vminpoly”. “Drupal.behaviors” confusion

I think this could be really useful to the masses. I've so far not found a alternative. If you know of one, please do advise. My use case is having a banner with a height of 85% of the viewport. The ...
0
votes
2answers
1k views

How do I add a JavaScript file to a form?

I'm trying to add a JavaScript file to a form that I have in a modal. Although I followed the information found here, here, and here, the file doesn't appear in the Network tab of the inspector and ...
1
vote
1answer
441 views

How do I add JS files inside libraries conditionally based on versions of IE7 and IE8?

In Drupal 8, how would you load a JS file inside a library to only load on IE8 but not lte IE7? I have the following added which correctly loads only on IE8 and lower. js: js/script.js: { ...
6
votes
2answers
1k views

Including a Library ONLY on the Front Page

I want to load JavaScript only on the home page of my site. I found this preprocess function but I don't know how to customize it for the home page: function mytheme_preprocess_maintenance_page(&$...
1
vote
1answer
487 views

How to define jQuery in libraries for avoiding conflict with theme with library?

For use of most frameworks (Zurb Foundation, Bootstrap, etc) or libraries (Like Owl carousel, Slick, etc) within a theme, jQuery has to be added as a library. Is it enough to add jQuery only once ...
0
votes
1answer
591 views

How to use drupal_add_library with a module?

I'm new to Drupal and don't really understand how to set up drupal_add_library. I've made a simple module that links out to a .js file. However, this .js file depends on a couple of generic functions....
1
vote
0answers
458 views

How to update jquery and jquery ui

I am on 8.3.3 and I would like to update jquery and jquery ui to the latest stable version of both. I do not want to update drupal core only jquery and jquery ui. Anyone knows how to do that?
0
votes
2answers
1k views

Attaching libraries to specific controllers

I want to include the google charts js library to a specific (or set of) controller(s). In my library file, gcharts.libraries.yml, I have the following: google_charts: remote: https://developers....
1
vote
0answers
113 views

Library .js file getting corrupted

I'm trying to get views slideshow to run on a Drupal 8 site. I've followed this tutorial and have downloaded the required libraries. I've set up the view, and it shows up fine on a page when it's ...
2
votes
1answer
528 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: ...
1
vote
1answer
405 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'][] = "...
0
votes
1answer
616 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 ...
1
vote
1answer
1k 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
172 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
119 views

Include third-party library

I have a third party library located in the root/libraries directory, but it is not called on my webpage. I was wondering using subtheme/subtheme.theme or subtheme.libraries.yml. I call it from here? ...
0
votes
1answer
94 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/...
1
vote
1answer
119 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
174 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 ...
1
vote
1answer
22 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 ...
-1
votes
1answer
25 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
197 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. ...
2
votes
0answers
70 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-...
0
votes
2answers
51 views

Exclude a JavaScript file from a node

I'd like to exclude a js file from loading on to a specific node. Right now my libraries.yml file looks like this: global-styling: version: 1.x css: theme: css/bootstrap/bootstrap.css: ...
0
votes
0answers
43 views

Javascript not working for unauthenticated users

I have some script for a "back to top" button. The script works fine when I'm logged in, but it does not work when I'm logged out. I've read about dependencies, but I think I'm doing them correctly: ...
0
votes
0answers
14 views

How to add 3d party js library to the project?

For my D8 project I am doing some optimization for mobile devices, and for node views it is very important for us to implement hyphenation for the titles. Based on my research the css property hyphens:...
0
votes
1answer
534 views

Add radio buttons and text field together to theme-settings.php

I want to integrate a CSS switcher into my theme, but without the Color module. So I want a radio button list, (or a select list, or dropdown, doesn't really matter), with a list of different styles, ...
-1
votes
0answers
7 views

Setting modal that triggers form in custom block in header

I made a paragraph with form and placed it in custom block in header. Form has a modal that pops up a form when clicking on a link in a navigation. I've set my form in region--header.html.twig but it'...
0
votes
1answer
17 views

Creating an image upload input field

I'm creating a image upload input field in blockForm which will output to Twig later. But got stuck due to some stuff. public function blockForm($form, FormStateInterface $form_state){ $form['...
2
votes
1answer
2k views

Retrieve taxonomy terms with EntityFieldQuery for a given parent term

I am retrieving a tid of a taxonomy term by using EntityFieldQuery. However, I need to cross-link the taxonomy_term_hierarchy table to list those terms which have a particular parent, but I am not ...
2
votes
1answer
2k views

How do I extend a configuration form without using hook_form_alter()?

I want to extend some fields in a config form of a module with another module in Drupal 8. I created a config form in a module (e.g. custom_1) and now I want to add some more fields from another ...
0
votes
1answer
315 views

How to add a 3rd party library and call it using Libraries

I've installed the Libraries module. How can I add a 3rd party PHP library in my Drupal 7 project. How do I use hook_libraries_info()?
-1
votes
1answer
24 views

Retrieving value of paragraph type with entity reference revision through preprocessor

I have created a paragraph type which has field of type entity reference, link, plain text. Now I want to fetch the values present in these through the preprocessor.paragraph.inc and display it in ...
1
vote
1answer
560 views

Cannot install modules

I am very new to Drupal so please excuse me if this is an easily answered question. Basically I wish to install CKEditor, however when I upload the module thorugh the online installer I am greeted ...
1
vote
0answers
9 views

Use generated JWT from Keycloak to authenticate user in Drupal using REST API

We are working on developing a mobile app and users should be able to log in to the app and in our backend Drupal site authenticated from Keycloak. Our main goal is that the user would be able to ...
0
votes
0answers
12 views

How to show menu items depending on the user's roles and the node type?

I would like to show some menu items (merged with the main navigation menu) when viewing a node (full content) of a custom content type. Also, this menu items depend on user's roles. It could be ...
0
votes
1answer
567 views

How to have OutboundPathProcessorInterface change the URL of the loading page

I have a page my/topics. The page presents content based on the user's selection from another page. Having made the selection, it and other information is passed to the page via a query string: ...
0
votes
2answers
14 views

CKeditor stripping allowed style attribute

I've installed Colorbutton to my Drupal 8 site. I have enabled the button for Full HTML and For Basic HTML I have allowed the attribute <span style> in the Basic HTML allowed attributes area. ...
0
votes
1answer
49 views

Create the FooTable functionality by using only views

I noticed by using FooTable display on one of my view on a Drupal 8 site, it is increasing the load time of the view by more than 2000 ms. The main idea i am using Footable is because of the ability ...
3
votes
2answers
903 views

How do I get comments to be indexed?

I'm not sure if it's actually doing this; I can't see any options for comment fields in the configuration. How can I check? Does it say explicitly somewhere?
-2
votes
0answers
9 views

Notifications_Node_Update_Event not load on cron

When i execute a cron, i got this error : PHP Fatal error: notifications_cron_queue_event_worker(): The script tried to execute a method or access a property of an incomplete object. Please ensure ...
0
votes
2answers
135 views

Want to display the validation error message above the webform

I have a webform created in Drupal 8 using the webform module I have to submit the data to 2 different 3rd party API. The scenario is I have to submit the data to the 1st API if there is no error ...

15 30 50 per page