Questions tagged [8]

Version tags should be used 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
1answer
50 views

How can I print the translated entity title in a template?

I have a reference field for nodes and I have a field template to render the the fields. {{ item.entity.title.value }} But I can't get the translated title of the node. Can someone help?
0
votes
0answers
45 views

How do I alter a bundle and programmatically add a form with a custom form mode?

I have created a custom entity type called custom_enitity and new bundle scores, using UI. Also got custom form display called score to add score via custom route. I keep getting the following error ...
0
votes
0answers
36 views

Multiple databases

I'm having trouble getting Drupal to switch between multiple databases. I have a system that involves connecting to an external database to retrieve data. I am using the following code inside of a ...
1
vote
1answer
37 views

How to create a view of Media images that do not have any Alt Text

For accessibility purposes I want to create a view of Media images that do not have any Alt Text. Creating a view of Media images and also displaying Alt Text is not difficult, as explained is this d....
1
vote
1answer
33 views

How to set the href with the pathname of the current page in it?

Inside a view I have a block for which there is a field called Global Perspective. Inside the block override , I have rewrite rules which overrides teh out of the field with custom text. <div class=...
0
votes
0answers
35 views

How do I build custom options for sections?

I manage to build/define some custom blocks with my own parameters/form elements when placing them, so I'm looking to do the same with sections. I've seen that the core code does that, but ideally I ...
2
votes
0answers
16 views

Entity Validation API not invoked on saving the taxonomy overview form – misunderstanding or a bug?

I have a Constraint and ContraintValidator to validate a field of taxonomy terms. Its a hierarchical taxonomy called channel with a field field_product. It's required that a channel has the same ...
3
votes
1answer
51 views

How to get a view result programmatically without exposed filters respected

I have some views of display page which I do not want to show to public if there would not be any result when accessed without any exposed filters set. I have a custom views access plugin and a custom ...
0
votes
1answer
22 views

Commerce custom taxtype wrong calculation

I want to add spanish recharge tax to drupal commerce. It is calculated like VAT but only for some customer in a B2B bussines, and It is a second tax, that is, you have to calculate VAT and "...
4
votes
1answer
54 views

How to add an autocomplete field with pure javascript

I'm implementing the javascript library Annotorious which allow to add annotations on an image. My goal is to be able to link content with part of the image select with Annotorious. When we select a ...
0
votes
0answers
25 views

Clean pagination URLs

I'm currently upgrading my site from Drupal 7 to 8 and I'm having trouble with the pagination URLs. On the Drupal 7 site we use the Clean Pagination module which changes views pagination to be /news/...
0
votes
0answers
18 views

Views agenda page not updating (still cached)

I have a Views page to create an agenda of events. The views has a filter to show only agenda items that are in the future. I created a similar setup for multiple site but on this one the agenda is ...
0
votes
0answers
14 views

Configure Facets to drill down one level at a time

I have vocabulary ("Subtype") hierarchy like this... CP LP ML U BL FL AD MA PD OPD SG I have a field on my entity type field_subtype. What I'd like is to configure my search api ...
0
votes
0answers
56 views

Antibot Failing when Webform Embeded in Gutenberg

When enabling Antibot on a Webform rendered through Guntenberg, I can not submit the form. Create a "Custom Webform" block type with a single entity reference field for Webforms. Create a ...
0
votes
0answers
11 views

Filter view by entity sub-queue?

Is it possible to filter a view by a sub-queue within an entity queue? My current setup is: Entity queue with multiple sub-queues created (I've only created 2 sub-queues at this point.) Setup a view ...
0
votes
0answers
38 views

How to disable an alias path (for an unpublished page)?

As path aliases now seem revisionable (from 8.8.x, see Convert path aliases to full featured entities) what is the best way to set an unpublished page (that was unpublished by a content moderation—as ...
0
votes
0answers
11 views

Does the login-link users receive upon registration actually expire?

I'm trying to expand the duration for the expiration of the one-time-login for the initial registration process: user clicks on "create new account" after filling name and email and sending ...
0
votes
1answer
70 views

How to get parent paragraph from a child block preprocess

Searched all over the place but cannot find anything similar. Here's the issue... The setup: 'Page' content type 'Block Content' paragraph type The 'Page' content type has a field for referencing ...
0
votes
0answers
20 views

Can't get distinct rows from taxonomy view

Drupal 8 has a problem with creating distinct views, and the distinct views module hasn't been ported yet. I've been researching this today, and haven't found a good solution. I wrote a custom hook in ...
0
votes
1answer
8 views

Get all available promotions for specific commerce product

How to get all available promotions, which apply to specific product?
0
votes
0answers
15 views

I can't alter the 'entity.media.route'

I want my drupal user to see the media edit form using the frontend-theme, not the admin-theme. In my RouteSubscriber I use if ($route = $collection->get('entity.media.edit_form')) { $route->...
0
votes
0answers
35 views

Create multiple Menu blocks from the same menu

In Drupal 7, the Blocks page contained a link for 'Add menu block', from where you could create multiple menu blocks of the same menu. In Drupal 8, menu blocks seem to be generated automatically, ...
0
votes
1answer
50 views

What is the correct order of disabling the default contact form on Drupal?

Drupal comes with a default contact form on each site we install. And while we already have the webforms and recaptcha module installed, some of our site owners still use the default contact form ...
0
votes
1answer
22 views

Hide/mask link URL in the web browser

I'm new to Drupal and here is the requirement - There is a page that has a field (Doc link) of type Link. I give the URL of the Doc link field as /sites/default/files/docs/file1.html. Now when I click ...
0
votes
0answers
23 views

Change View Slideshow slide dimensions

I have the Views Slideshow module running a slideshow of 4 items in it and the background image is set to an image style that scales to 695px height (and no width setting). This also happens when I ...
0
votes
0answers
29 views

Add status field to existing entity

I wanted to add the "status" field to an entity that already exists but is not mine, i.e. I cannot edit the php class where this entity is defined. With the following code I add the field in ...
0
votes
0answers
33 views

How to use one of the 2 context filters in a view (with an OR)? [duplicate]

I have a view with 2 relations with the store for 2 different entities. I want to filter the view with the store id for the 2 relationships. I created 2 context filters in the views. You must use the ...
-1
votes
1answer
44 views

Site broken with multiple errors

I am trying to install a Drupal site locally on a new laptop that was working fine on the old one. I get the following errors. Notice: Undefined offset: 2 in Drupal\Core\Database\Database::...
0
votes
1answer
44 views

Import configuration in CI/CD script does not work

I have a Drupal 8.9.13. I wanted to install a new module, for example the google_tag. But in my case I do that in my CI/CD process. So to do that I did the following actions: edit the composer.json ...
3
votes
1answer
40 views

How to determine if {{user_picture}} is not empty in the comment.html.twig template

Trying to determine if {{user_picture}} is not empty in the comment.html.twig template. {{user_picture}} refers to the Compact display mode for a User Entity. The below code doesn't work. {% if ...
3
votes
1answer
105 views

How can i add a property(uuid) to existing custom entity base_table?

I want to add uuid property to existing custom entity extending ContentEntityBase. I've tried to a add the uuid entity key and installed field storage definition by: function ...
0
votes
0answers
17 views

Use patch for .htaccess only on remote site

Following this post I'm working on a way to patch my .htaccess file so my changes don't get overwritten by a drupal update. But my .htaccess files most of the times are in my .gitignore because the ...
1
vote
0answers
39 views

How to render a view in an ajax callback

I am trying to develop a custom module to ajaxify the commerce form block. I tried using dc_ajax_add_cart and ajax_add_to_cart but they were not addapted to my project. I have the following callback ...
0
votes
1answer
46 views

How to get a custom block form in another custom block?

I have a custom block /** * Provides block A. * * @Block( * id = "block A", * admin_label = @Translation("Block A"), * ) */ class Block A extends BlockBase implements ...
0
votes
1answer
16 views

I can't filter the child view based on a value from the parent view

I have read many of the questions asked on this site, but none of them suited my problem. What is the need to make a Users view that shows below its created contents. I have a website with 3 roles. ...
0
votes
0answers
18 views

Determining unauthenticated user when session cookie exists

We've been experiencing some strange behavior in regards to user sessions that I need help understanding how Drupal determines if a user is authenticated or not. We have a custom endpoint to log in ...
0
votes
0answers
4 views

Custom Form using Geofield and linked to a View

I have created a custom form & block which takes a postcode or suburb value and enters it into a return url (https://my-d8-site.ddev.site/store-locator?field_geofield_distance[distance]=20&...
0
votes
0answers
49 views

How can I programmatically create an user account and trigger an activation email?

I developed custom module to create users. And I setup config account setting "Require email verification" to "Require a verification email, but let users set their password directly on ...
1
vote
2answers
113 views

How to alter the parameters in the core.services.yml file programatically?

I need to modify the filter_protocols parameter inside the core.services.yml file programmatically to add a new protocol. I know how to alter a service but I don't find any information about how to ...
1
vote
0answers
18 views

User ID 0 with many roles

I was doing a custom code for a custom page that I have created through my controller where I set a user field named MyChoice and I add a role "freeaccess" for the user who opens this page. ...
0
votes
0answers
28 views

translatable content: how to set default original language

I've a D9 site, configured with two languages: Italian (default) and English. Some content types of the site are translable, the configuration under admin/config/regional/content-language for them is ...
0
votes
0answers
28 views

Generate a new password when a user account is activated and send an email with password

I am working on a web application using Headless Drupal 8 and Nuxt.js on the front. The app is to manage team members. Member can register (via REST API) without setting his password and wait for the (...
0
votes
1answer
57 views

Newly created field not being added to entity

I have created a form that adds a subset of field types to an entity (does not support bundles). (the reason for the custom form is that end users find the Drupal standard 'Manage fields' workflow ...
1
vote
2answers
25 views

Conditional Show/Hide Child Terms on Edit Page

I have a content type with a term reference. The terms have child terms. On the admin editing side, I want to show only top level terms until selected, then show only the child terms for that parent. ...
1
vote
2answers
28 views

Use theme template with specific Views

I have a D8 subtheme of Bootstrap and on the homepage I have 2 Views (2 carousel views). I turned on twig debugging so I could see which template file(s) is (are) being used, and where it starts and ...
0
votes
0answers
10 views

How to add “clone” button to WebformMultiple field

I created a custom composite field with a dozen or so fields, in a custom module extending Drupal\webform\Element\WebformCompositeBase. I need to add a "clone" button to the webform multiple ...
0
votes
0answers
19 views

Views field override and use it in Global: Custom Text

In Drupal8, I have created a view of content and add a relationship of the user account field which is referenced entity of the content. So, Basically I have one content type and in the account fields ...
1
vote
1answer
42 views

Ajax enabled form stopped working - Ajax callback never called

I have the weird problem that an Ajax enabled form that just worked stopped working - and I have not a clue what is causing this and when it stopped to work. The form itself has no changes for months ...
2
votes
1answer
91 views

Pathauto pattern for a content type depending on a reference field?

This question is already asked here, but the answer selected does not work for Drupal8. Description: There is a content-type, which has field, referencing taxonomy term. The term is in "Content ...
0
votes
0answers
15 views

Views custom relationship joined by plain text field

Let's say I have a node type named 'Book'. 'Book' nodes have 'publisher' field. I want to create a node view which displays these two columns: book title title of a book published by the same ...