Stack Exchange Network

Stack Exchange network consists of 175 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 [8]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

1
vote
1answer
38 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 ----...
1
vote
1answer
184 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 ...
0
votes
1answer
31 views

Where do I place helper files? [duplicate]

I would like to place some (PHP)functions in a helper files, which requires across modules and themes. Do I have to create a new module or I can place a simple helper file with list of common ...
0
votes
1answer
249 views

How to add print stylesheets

How do I add a print stylesheet in Drupal 8? Here is what my libraries file looks like in my theme... global-styling: version: 8.0 css: base: css/style.css: {} theme: css/...
0
votes
0answers
18 views

How does drupal recognize the external js library imageflow with the libraries module?

I want to upgrade the imageflow module to drupal 8. Therefore I created a module "myimageflow". "myimageflow.libraries.yml" seems to be ok according to function myimageflow_library_status(), but ...
0
votes
1answer
27 views

Adding core Javascript libraries in my_module.libraries.yml

I've read Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module and I can see where you can add assets that are part of your module or from a CDN or external source. What about if that ...
8
votes
3answers
13k views

How do I make a theme require Jquery (for anonymous users)?

I'm creating a theme for D8 called 'herchel'.I'm trying to get this theme to require jquery on all pages (D8 doesn't load Jquery for anonymous users by default) Looking through the what little ...
2
votes
1answer
2k views

How to load jquery cookie library for anonymous user

It seems with login user jQuery Cookie added and worked correctly but when I visit my website with not login user(anonymous) then I faced with TypeError: $.cookie is not a function. Why This ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
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 ...
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:...
-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

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 ...
-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
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
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?
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 ...
-3
votes
0answers
12 views

Running Drupal 8 on AWS lambda [on hold]

Is there anyway to run Drupal serverless? I search the web and the closest I can find is this site https://www.slideshare.net/AmazonWebServices/making-headless-drupal-serverless
0
votes
0answers
42 views

Passing variables between theme preprocess hooks

I'm a newbie to Drupal 8 and PHP coding in general so I hope my approach is not too much out of the lines. I'm trying to theme some parts of my website by fiddling a bit with templates, what I need to ...
0
votes
1answer
576 views

How to create a parent content type which consists of other child content types?

I want to create custom content type (parent) which consists of other custom content types (children). Is this feasible in Drupal 8? Or I should do it programmatically? Example: I want to have custom ...
0
votes
2answers
25 views

How to attach media item created during migration to media field in node

I am migrating content from Drupal 7 to Drupal 8. There is an audio field that I am currently moving to media via a custom process during migration. When I get the id of the new media created I can't ...
1
vote
2answers
647 views

Update website from 8.0.0 to 8.6.1

I'm pretty new to Drupal and I'm trying to update a website from 8.0.0 to 8.6.1. I've followed the guide here: https://www.drupal.org/docs/8/update/update-core-via-composer The composer part went ...
1
vote
1answer
272 views

How do I create a custom view filter for an existing field?

I ran into a problem with creating a custom view filter for an existing field for Drupal 8. I mean a filter not for fields like "nid", "title" and so on, but for fields, which were named CCK-fields ...
0
votes
0answers
39 views

Why isn't the access check being called at all?

I have the below code. I have set up the business logic and it works fine in a .module file, but not in an access controller. What am I doing wrong? // nodeaccess.routing.yml nodeaccess.people: ...
1
vote
1answer
546 views

RouteNotFoundException when trying to delete a custom entity

I am building a custom component in Drupal 8 that has an entity with child entities i.e., TeamEntity has one or more MeetEntity objects. When I navigate to the "Delete" link for a given MeetEntity, I ...
1
vote
2answers
65 views

How can I print the vocabulary name instead of the referenced term in a node template?

Let's say I have a content type article with a field "taxonomy". The vocabulary is "fruits". The terms are "apple", "orange", "bananas" The article belongs to "orange". I can easily print in my ...
4
votes
1answer
703 views

Send mail notification when node of given type gets created

Use case: a small site where I want to warn all users by mail whenever a new content of a particular type is created. I thought I would try Rules+Actions to handle this. I'm working on a vanilla ...
0
votes
1answer
589 views

Creating a layout with Page Manager

I'm trying to use Panels and Page Manager in Drupal 8. My current versions of each are: Page Manager: 8.x-1.0-alpha23+12-dev Panels: 8.x-3.0-beta4+41-dev My current problem is having no idea how to ...
0
votes
0answers
13 views

Site wide settings versioned & staged

I'm developing a decoupled site and there's some site wide settings, such as logo, social links and others that appear in multiple places so we're looking to have a centralised location to store them ...
-1
votes
1answer
53 views

Export/import users

I am looking for a way to export users from one Drupal 8 Site into another Drupal 8 site. Is it possible to do this by exporting and importing the Users tables? If so which ones? I see there are ...
0
votes
1answer
488 views

Ajax form an multi-select

I have a form which provides select2 when the select1 is changed. However I would like select2 to be a multi-select. I can't seem to get this to work. It populates a single select input just fine, but ...