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.

0
votes
1answer
27 views

How to do an EntityQuery on a custom User field?

I'm having trouble figuring out how to use the EntityQuery on custom field values. As an example I have a custom field under the User bundle that stores the country in which the user lives. There are ...
0
votes
1answer
14 views

How do I change the Views (Entity Reference) filter via AJAX?

I have an entity form that allows an admin to select a content type (checkbox) and an autocomplete field that is tapped into a VIEWS Entity Reference (via the Reference Method). Goal: What I would ...
0
votes
0answers
12 views

Can I remove warnings/notices from the output of “drush pm:security --fields=name --format=json”?

Running a command similar to drush pm:security --fields=name --format=json gives me what I am looking for. Is there a way to remove warnings and notices from the output? I can't see anything in the ...
1
vote
1answer
17 views

Use hook to get the domain configuration from language

We have enabled English, Spanish, and French on our site. On Regional and language >> Languages detection we selected URL for Content language detection >> Detection Method. For Part of the URL that ...
1
vote
1answer
36 views

Wrong User Image Display - Weird Twig Cache?

I'm having a weird issue with incorrect user images being displayed and it seems to be a caching issue or perhaps I am passing the user image incorrectly to my template. Problem: If I login to a ...
0
votes
0answers
24 views

How to get referenced entity fields from another content type in single node template [duplicate]

I have a content type called "Resources", this is referenced from another content type called "Projects". I can get simple text fields in my single node--project.html template for example - {{...
0
votes
2answers
31 views

Can I store media files in the private directory?

The normal behavior, described also in Give access to private files to certain role? seem to be the following. Once configured, files stored in the private directory are inaccessible via a direct ...
0
votes
0answers
24 views

Migrate scheduled content

I am in the midst of migrating a Drupal 7 site to Drupal 8 (8.7.1.). I have some content types that use Scheduler to publish/unpublish content. How can I migrate the publish/unpublish dates? I have ...
0
votes
2answers
41 views

How do I pass a value to a content type field with a custom submit please

and thank you for your patience in helping me learn I have created a content type called response (Through Drupal, not in a custom module) In the content type I have a field called ...
0
votes
0answers
45 views

How to distribute/share a drupal 8 project/product?

I have a site that I've built with Drupal 8, using composer and git to manage the codebase. It's a fairly simple site that includes a handful of contrib modules, a few custom views, and a custom theme....
0
votes
1answer
27 views

How to push values from views attachment to Javascript?

I have a table view with both filters and exposed filters, and attached to it there is another view that uses views_aggregator_plus to display a summary of months and different value counts. I want ...
0
votes
0answers
32 views

Prompt user to download file via AJAX form submission

I have a file that is generated when an AJAX button is clicked. I want to immediately have a file download prompt come up. The file is being generated and has the correct data in the file. I just don'...
0
votes
1answer
42 views

How to use t() function in controller?

I understand Drupal 8 ControllerBase implements StringTranslationTrait so we can use $this->t() in Controller class. But I found in Drupal 8 examples code, they setStringTranslation to use t() ...
0
votes
1answer
56 views

How to redirect to content if view have 1 result?

Views page show content. How to redirect to content page if views has only one result?
0
votes
0answers
17 views

Priority of aliases files for Drush

I have an installation with lando. On the project, we have a directory drush with an aliases file for the project. This file defines aliases with the root specific for the lando architecture. In my ...
1
vote
2answers
45 views

Change autocomplete results based users selected checkbox

I have a drupal 8 site that uses the paragraphs module. In one of the paragraph is a field that contains an autocomplete field. It is already set up to reference a small list of Content Types. For ...
-2
votes
1answer
43 views

Drupal 8 and Moment JS - To fix client side date format issue on browser wise

Different Browser and OS shows different date format on client side. In Chrome: dd/mm/yyyy In Safari: yyyy-mm-dd <input data-drupal-selector="edit-field-date-end-value-date" title="Date (e.g. ...
0
votes
1answer
25 views

Form fields still treated as required even after setting #required to false

I'm using hook_form_alter to remove the "required" setting for a couple of fields, specifically the First name and Last Name fields on the Address form. Here's my code, where I provide a callback ...
0
votes
1answer
27 views

Add target blank to an image link

How do I add target='blank' to a href in a Drupal 8 custom module? Below I have the image being wrapped by the uri. I don't know how to add target='blank' $element[$delta] = array( '#theme' ...
0
votes
1answer
19 views

Content Admin Search Tool Drupal 8

As a content admin, are there any feasible ways in Drupal 8 to search the source HTML of certain Text fields across multiple content types. For example, I want to find all nodes that contain <div ...
1
vote
3answers
95 views

How can I provide an autocomplete filter for tags in a Search API view?

I'm working to create a Search API view. I have an exposed filter that's a fulltext search filter. I'd like to expose another filter that works similar to the exposed entity reference, which allows ...
0
votes
0answers
46 views

How do I extend Drupal\Core\Database\Driver\mysql\Select?

Currently, my website uses MySQL. I want to override some methods on the Select when I use the following code. $query = Database::getConnection()->select('my_table', 'my_table'); $query->...
0
votes
1answer
21 views

comments module with infinite scroll

I've added a comment field to my content type. Now I'd like to add infinite scroll to the comments messages, so it shows by default some number of comments and when I click on the load more button, it ...
1
vote
0answers
13 views

Caption field with default value inside CKEditor

I activated the caption filter under Text format configuration to add description to media inserted via CKEditor Is there a possibility to add a default value to this caption field whenever I add a ...
0
votes
1answer
20 views

How to use the YML structure of routes to control access to Group Content

I am using the Group module and would like to leverage each Group's permissions in my module's yml files. I have a module.permissions.yml with something like tam_api.group_gid_members_uid: path: ...
1
vote
2answers
38 views

Creating a view with multiple latest content types

I am looking to create a view for my home page that displays the 3 last added items for 2 different content types (articles and news). Like 2 lists next to each other that also has the option to show ...
0
votes
1answer
43 views

How to put a link in my route title?

In my custom module amap, I have amap.routing.yml with (among others) this route: amap.distribution_inscription_many_form: path: '/amap/editPlanningMany' defaults: _form: '\Drupal\amap\Form\...
0
votes
0answers
29 views

Commands doen't work because of the Address module and its dependencies

When I try to use a Drupal Console command, even a simple a drupal list, I get an error. Fatal error: Class 'CommerceGuys\Addressing\AddressFormat\AddressFormatRepository' not found in /path/to/...
0
votes
1answer
25 views

Facet - default value with search api

I am using content type in Facet. The search result will be having an option to choose the content type to filter the result. I want the search should show the result with particular content-type ...
2
votes
1answer
72 views

Is there a “best practice” for overriding a contributed module's controller in Drupal 8?

I'm still relatively new to Drupal 8 and recently I came across an occasion to override the WebFormSubmissionListBuilder Controller. I eventually found another project which had exactly the same need ...
0
votes
1answer
112 views

Why can't I update core from 8.6.16 to 8.7.1?

I need to update my Drupal 8 site from 8.6.16 to 8.7.1, but when I run composer update drupal/core --with-dependencies it says "Nothing to install or update". I have been banging my head on the wall ...
0
votes
0answers
23 views

Check for cookie value(s) for a visitor and attempt to authenticate them?

I have a case where when a visitor comes to the site from a subsite (different application), if they are authenticated (there will be a cookie value), I need to get this cookie value and initiate a ...
0
votes
0answers
11 views

Is there a way to add custom fields before the “Add to cart” option with the “Basic Cart” plugin?

I'm using the Basic Cart plugin to create orders in Drupal 8, but I have a problem. Before I add some products to the cart, I have only the Quantity option which the default plugin option. Is there a ...
0
votes
1answer
29 views

Can't set arguments to a view for displaying all data

I use $view = views_embed_view('export_emargement','page_1',$journee,$region,$produit); it works well, but If I don't want to specify $region the view does'nt works. Im my view admin if I set ...
0
votes
1answer
40 views

REST login problem

I'm trying to log in to drupal8 via api rest using postman. POST: https://example.com/user/login?_format=json Content-type: application/json { "name": "admin", "pass": "password" } The problem is ...
0
votes
0answers
26 views

Get input label on input.html.twig file

I'm working on an input.html.twig file. I need the label name of the input for class and other reasons, but for some reason, I can't figure out how to grab it. I thought it would be part of the twig ...
0
votes
1answer
74 views

Drupal 8.7.0 chmod() and touch() operations not permitted

After updating drupal8 for 8.7.0 and then to 8.7.1 versions i have next errors: Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line ...
-5
votes
1answer
39 views

Automatically redirect user depending on its device screen size?

In a custom module (amap), I have two forms with the same final purpose: handle (create, update, delete) a custom content entity (distribution_inscription). The first one (...
1
vote
2answers
30 views

How to get my custom module to recognized a exported view?

I have created a view and then exported it normally to a yml file. Then I put this yml file into my mycustommodule/config/install folder. So current its named mycustommodule.view.user_assigned.yml ...
0
votes
1answer
30 views

Not able to enable 'Configuration Translation' module gives error

I am trying to enable MULTILINGUAL -> Configuration Translation. It gives below error. Error: Call to a member function getPath() on null in Drupal\config_translation\ConfigNamesMapper->...
1
vote
1answer
10 views

Configuring Fail2ban for the r4032login module

Recently, I installed fail2ban on my server to help prevent bots from abusing the site. I have the r4032login module installed and it is writing to the log, but it is using HTTP status 302 for the ...
0
votes
2answers
133 views

How do I prevent anonymous sessions?

I'm working on a site hosted on Acquia and we're using Varnish and Akamai. We don't want anonymous sessions from being saved in the db, as it breaks the caching. I've made a few tweaks, and I'm ...
0
votes
0answers
13 views

Taxonomy terms not localized in view with enabled aggregation

On a view on content, I added a field "All taxonomy terms" (Display all taxonomy terms associated with a node from specified vocabularies) and enabled aggregation, see screenshot of view attached. ...
0
votes
0answers
30 views

Doing a checkout via API?

I am trying to figure out if it is possible to do a checkout via API for Drupal commerce 2. In Drupal 7 there was a module Commerce Services Resources. I found some posts, but they don't answer my ...
0
votes
0answers
25 views

Send shipment tracking number to customer

Drupal commerce 2.x Seems all shipment tracking number modules are for drupal 7. How can I enter and send a tracking number to the customer when order is marked as fulfilled in the commerce ...
0
votes
0answers
37 views

How to get translated term name from TID in views field template?

For a complex view, I need to alter the output of a localized term field: instead of putting out the TID of the term, I would like to render the localized term name. Does someone know how to alter the ...
0
votes
1answer
14 views

Stale Pathauto Alias

I'm just curious how other Drupal developers handle nested path aliases when they are based on another page's url pattern. I have a product landing page (it's a "basic page" node). When it's created,...
0
votes
0answers
24 views

Errors while updating core to latest version

I have a website I had worked on but never finished, last year. It is at version 8.5.4. I've imported it (from a devdesktop environment) into a Docker/Docksal environment. At this point I can see a ...
0
votes
0answers
23 views

How do I programmatically get the flag creation time?

I need to get the creation time for a flag on a node. I started with the following code, but I probably need to use getEntityFlaggings() passing the node and the flag ID. $flag_service = \Drupal::...
0
votes
1answer
49 views

How do I a custom entity operation with a webform submission?

My lack of D8 experience is going to show by just how many unknowns I have here. I hope someone can link some of the pieces for me. I created a custom action using hook_entity_operation_alter() on ...