We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [8]

Version tag to tag issues specifically related to Drupal 8.x. Please note that version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Customized copy of whole site in subdirectory [on hold]

I'd like to implement a website with multiple, slightly different versions of the whole site available under a single domain. The separate versions of the site should be accessible under different URL ...
-1
votes
0answers
26 views

Checkout guest email

I'm just starting with the Drupal and I'm trying to setup online store with commerce 2 and Belgrade theme. At the checkout page when I try to checkout as a guest it automatically fill up the email ...
0
votes
1answer
54 views

Pass field value of original node in webform

I'm using Drupal 8.7.8 and Webform 5.4.0. I have multiple section nodes that are displayed on course nodes. These are 2 different content types. I'm adding webforms to sections, via the twig file ...
0
votes
0answers
22 views

How do I combine 2 or more fields in an exposed filter?

I am using the Combine fields filter to search in 3 fields. A referenced image name. Media ID And the image alt text. I had to use a rewrite in the alt field. The Combine fields filter searches the ...
0
votes
0answers
29 views

SweetAlert doesn't display content markup

The SweetAlert modal is not displaying the content as passed in the option array when returning a response from the controller. Please see the code config below: //$options = ...
1
vote
1answer
41 views

.htaccess rewrite doesn't work [closed]

I have custom module with page at /page wich expects $_GET['id'] to do it's job. Here's .htaccess rewrite rule that works on empty website RewriteRule category+/(.*)$ page.php?id=$1 [L] On Drupal ...
0
votes
0answers
25 views

How to Resolve CORB Issue using Drupal Docker Container

I'm running the latest version of the Drupal docker container. I'm trying to make a GET API call via Javascript and I'm receiving back CORB (cross-origin-read-blocking) errors in the Console when ...
-6
votes
0answers
31 views

How can I make core menus collapsibe?

I am still new to using Drupal 8, but I wanted to know if the core menu of Drupal can be made collapsible as currently the menu is collapsed completely. I have been trying to find menus that can do ...
-3
votes
0answers
22 views

Did “Simulate checkout completion” link get lost on cart edit?

In D7, when editing a "cart" order, there was a link to "Simulate checkout completion". Did this feature get lost in the porting to D8?
1
vote
1answer
44 views

Override a theme template variable with a module

I created two variables for use in my theme's page templates. I used variables because I wanted that value to be flexible. function mytheme_preprocess_page(&$variables) { $variables['var1'] = '...
2
votes
1answer
48 views

notify user account creation?

I can't seem to find documentation for notifying a user via email after their account has been created by a script. $user = \Drupal\user\Entity\User::create(); $user->setPassword('xxx'); $user-&...
1
vote
0answers
17 views

Geolocation: How do I set conditional markers on the Leaflet view?

I'm using Geolocation to list about 20 pubs / restaurants, but I'd like the user to be able to know if the address is a restaurant or a pub just by seeing the icon. When I created my content type, I ...
0
votes
2answers
28 views

Hide contextual filter parameter from view url

I'm using Views to create a view which shows list of contents. The requirements of the view is something like this: The page display url must be /mycontents The contents must be filtered by current ...
0
votes
1answer
28 views

How to add a local image file to an image field programatically

I have serveral image files in the folder /sites/subsite.example.com/files/blog.dir/1/gallery1, and I need to add these files to a node programatically. I think this is the right code: use Drupal\...
0
votes
1answer
39 views

Hide certain field on form alter using AJAX

I have a webform created using interface, and need to hide some fields through button. Using form_alter I have added that button added AJAX call with it. Now I want to remove/hide certain element ...
0
votes
0answers
20 views

Set default/restrict text formats based on node type [duplicate]

In Drupal 8 (not D7) as noted here How do you limit a text input to only specific content types/fields. For example, I create a new input type here: admin/config/content/formats and call it "...
1
vote
1answer
39 views

How to stop download in hook_file_download

I'm building a page with different download buttons linked to private zip files. Users have to log in to download. I am using module Permissions by Term to manage who can see which button. I added a ...
1
vote
1answer
37 views

If content type with specific field that is not empty has specific taxonomy term attach library [closed]

I would like to attach a specific library using a taxonomy term to a content type with a specific field that is not empty. The following is not working: function lehigh_preprocess_page(&$...
1
vote
2answers
38 views

Using variables in an expression

I am checking for a specific block in a specific theme region. {% if page.header_first.blockmachinename %} // Show stuff {% endif %} This works when I have the right machine name. But I want to ...
0
votes
1answer
24 views

Check access to existing plugin block

I have a programmatical plugin block defined in theme region. I need to check access to this block in my module hook. The following code creates a new instance, but I need to load an existing plugin ...
1
vote
2answers
54 views

Detect browser in preprocess function

My goal is to render a warning message to IE 11 users, prompting them to use a modern browser. I'm a bit of a noob, but from what I understand, it's possible to detect a user's browser using a ...
0
votes
0answers
31 views

How to use {{string}} to assign a value to an attribute in input tag (Twig Template)

I want to do the following: {% set var= "string"%} <input name='{{var}}' /> All drupal does is to ignore the tag in gerneral. If i set the tag like this everything is fine: <input name=...
0
votes
0answers
42 views

How to delete/remove a broken layout builder configuration?

I'm using Layout Builder to manage the display of a content type. I was playing around with the config and adding different things, and something I added caused the page to crash and now I get this ...
1
vote
1answer
69 views

How to load a taxonomy term with case-sensitive?

I used this $this->termStorage->loadByProperties(['name' => 'test']); I got two terms: Test, test. I want to get only one: test This is working without case-sensitive: $this->...
2
votes
0answers
33 views

Any downside when using block_content as custom content entities?

Background: For a tourism project I need to integrate volatile data from external sources (like snow reports for ski ressorts or movies and their showtimes). This data should not be accessible by its ...
0
votes
1answer
28 views

Make CKEDITOR Caption Required

Using Drupal 8 Ckeditor Core plugins -> drupalimage/drupalimagecaption how do I make an image caption required? The checkbox shown should always be clicked.
-1
votes
0answers
30 views

How to get additional field of menu link data? [duplicate]

I've added an image field to Menu item form by using MODULE_entity_base_field_info. The field worked. But how do I get that field in menu.html.twig template?
2
votes
0answers
121 views

How can I convert oauth2_token.value back to a Bearer token in simple_oauth?

I'm working on a headless Drupal 8 API that offers direct login links via email. For users who forgot their passwords or were invited but have never logged in, it's safe to just reset their password. ...
0
votes
0answers
17 views

Locking value of a field once created

I've been using the Feeds module to create/update some of my content types. I was wondering if there is a way to "lock" the value of a field once it is created. I've searched for a module called: ...
2
votes
2answers
31 views

Unit Testing code that retrieves content

I have a method which calls another one to retrieve a specific node ID. If it can be found, it then retrieves the node. Is this the kind of functionality that can be tested in Drupal? Or even should ...
0
votes
1answer
41 views

How to print in twig a Flag Link field

I have a views-view-unformatted.html.twig template working fine where I can print fields from a view of nodes. Example: having i = 3, print row number 3 title {{ rows[i]['content']['#row']._entity....
0
votes
0answers
13 views

Order date from order_entity in commerce-order--pdf?

I need an invoice of an order, so I use the print pdf module, but the date is missing. I have tried the following code from commerce-order--admin but it doesnt get any data. <h3 class="entity-...
-3
votes
1answer
51 views

The form has become outdated. Copy any unsaved work in the form below and then reload this page [closed]

How I can fix the error? The form has become outdated. Copy any unsaved work in the form below and then reload this page. I get the error when I try to render a form in another form. I think it can ...
0
votes
0answers
12 views

Media field image preview back instead of close

Drupal 8.x using: Media library & Focal Point module. I have a node type with a media field. When you upload an image in this field you can set the image information (functionality of the media ...
-2
votes
1answer
22 views

How can I display tags on one line [on hold]

How to change the below output of a drupal article Tags display with bootstrap theme To something like this which is displayed in stackoverflow below any questions Is there a ready made module ...
0
votes
1answer
37 views

Function to get node view mode name

I've been using $node->getType(); to get the content type. For view mode, I am following this method: Is there a function similar to getType() (that doesn't require adding a preprocess ...
0
votes
0answers
7 views

Is it possible to translate natural language date in an exposed views filter?

I got a view with an exposed date filter that limits the data to the start of the current year, and because of this the form filter has this text "first day of January this year". Is it possible to ...
1
vote
1answer
55 views

entity_autocomplete field thats added by ajax is not working

I have a field im adding to a node-edit form by ajax. the field is a simple taxonomy auto-complete field. when I add it directly in my form_alter it works, but when it's added by ajax, The ...
-1
votes
1answer
22 views

Can I use Flysystem with backup_migrate?

I would like to use Backup & Migrate for my Drupal 8 site. Is there a way to use Flysystem for backups? Should I install S3FS? I have Flysystem configured to handle all of my files and images ...
0
votes
0answers
21 views

Global attribute in Drupal Commerce 2

Got a question. How to create a global attribute in Drupal Commerce 2 that will use the added value to existing variations. Or as an option, the choice in the variation of 2 or more variants of the ...
0
votes
0answers
28 views

Can I clone the current state of a site when running tests?

I would like to prove that a series of permissions defined from a module are applied to certain roles. I need to test it both on a Drupal installation done from scratch and on a Drupal installation ...
0
votes
0answers
18 views

How to send mail with third party domains?

I'm using mailsystem and Swift Mailer. Instead of paying for a professional service or self-hosting, I'd like my site email to be sent using my hotmail or another domain I control. Eg let's say my ...
1
vote
1answer
28 views

How to prevent drupalSettings to sort settings object

I attach drupalSettings in a preprocess hook using code similar to the following one. $settings = [ 'bcd' => 'BCD', 'abc' => 'ABC' ]; $variables['#attached']['drupalSettings']['options'] =...
1
vote
1answer
19 views

How to show forums even if you don't have access?

This is a follow up to this question. I now know how to modify which forums are shown using the MYMODULE_preprocess_forum_list hook. But I have another scenario I can't figure out. When you create a ...
-1
votes
1answer
60 views

Add a css class to the active link then remove it when becomes inactive

I know this question might not fit here but I am afraid that I am doing something wrong related to Drupal since it is my first time with JS code and its implementation into Drupal core. I have placed ...
0
votes
0answers
10 views

Video Embedded Media and Image Media in one Colorbox Gallery

I'm trying to create a image/video gallery in Drupal 8 using Media in Core, Colorbox Module, and the Video Embed Module. The issue I'm having is that, if the gallery has both images and embedded ...
0
votes
1answer
17 views

Is there any elegant way of excluding form element from the `values` array of the `FormState`?

I know that the values array can be cleaned up in the validation or submit callback, but can we somehow mark the element itself to be not put in the values array of the FormState?
0
votes
1answer
12 views

How do you change the core forum module to only show a certain depth?

I am using the core forum module. If I have this forum structure: - A1 - A2 - A3 - B1 - B2 - B3 - C1 - C2 -C3 I want it to show A1, B1 and C1. As well as A2 and B2. But not A3, B3 and C3. ...
0
votes
0answers
26 views

How to wrap Paragraph fieldgroup horizontally

I want to display a few fieldgroups inside of a Paragraph side-by-side horizontally when in node edit form. I gave each fieldgroup the class .popular in the GUI in manage form display. The fieldgroup ...
3
votes
2answers
72 views

How to get node's view mode in hook_page_attachments?

I need to get the node's view mode so that in the mymodule_page_attachments, I can add libraries conditionally if the node's view mode is set to full or default. I tried the following but not able to ...