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
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
28 views

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

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
33 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
39 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
38 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 ...
-1
votes
0answers
38 views

Node variables in form twig template

{{ form }} is the only available variable in form.html.twig template file How can I access raw values from node fields in a twig template? I'm going to use hook_preprocess_node_edit_form for creating ...
3
votes
1answer
101 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
34 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
17 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
37 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 ...
-2
votes
0answers
32 views

How to check the machine name of the product type?

I have the TWIG code below that works. It checks that "Produit" is in the name of the product type. My problem : I want it to check the machine name of the product type (not the title of the ...
1
vote
2answers
105 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
17 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
27 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
56 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
23 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
26 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
8 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
14 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
41 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
80 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
14 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 ...
-2
votes
0answers
43 views

Current page link is not adding in my custom theme full pager links

I have created a view page showing products with full pager and full pager links are showing currently but current page link is not been added in the pagination links and because of this pagination ...
-1
votes
0answers
28 views

Add new default value to existing content type

I'm currently on the latest version of Drupal 8. I have a content type (News and Articles) which has a field (Category), a taxonomy term reference field. When I first created this content type I added ...
1
vote
0answers
43 views

When old field revisions should be deleted from the database?

I have a question about old fields revisions in Drupal 8. For example I have "Full Title" field in different paragraphs. I have deleted this field from one of the paragraphs, for example ...
0
votes
0answers
23 views

Single webform submission creates multiple submission entries

I've got a number of webform forms on a website and when a user submits a form, it creates 2-3 duplicate entries in the database. Everything in the entry is the same, timestamps et al. I'm sure it is ...
0
votes
0answers
9 views

How to display content tagged with child terms in views?

I have a taxonomy vocabulary general in which I have a reference field to user roles allowed_roles. I have two taxonomy terms. A and B where A is the parent of B. Now I selected test_role in the A ...
0
votes
0answers
16 views

How to get the file destination from a content type's field_image to upload programatically

I have a cron job that goes and grabs content from another resource and uploads it into my drupal site, and this includes a link an image that I retrieve and upload into my S3 file system. My site's ...
0
votes
0answers
22 views

2 content types and reference

I am using Drupal 8.9. I have 2 content types Teacher and Subject. Teacher has 2 reference fields of content type Subject (first one is the subject which the teacher is teaching and second one is the ...
0
votes
0answers
16 views

Token replacement in webform custom element (webform_score module)

I use the module webform_score for my project but the webform element RadiosQuiz doesn't handle the tokens replacement. I'd like to use tokens in title and options text. I look on the RadioQuiz.php ...
0
votes
1answer
31 views

Webform Custom element option values validate

Can anyone please suggest how to validate the custom element option values ( select). This validate should work, once we add new element to the form and fill the option value and then click save / ...
0
votes
0answers
20 views

Replace Block on click of form element

I have a block which contains a form (I used the build() method) . One of the form elements has a suffix as follows: $form['test'] = array( '#type' => 'number', '#placeholder' => t(...
0
votes
0answers
33 views

How do I connect Netbeans IDE to AWS Bitnami installation?

I'm hosting a Drupal 8 installation on AWS using the recommended Bitnami image. I'd like to be able to edit some of the files remotely from my computer using the NetBeans IDE. I've successfully ...
0
votes
0answers
13 views

How to decode base64 image using pre save hook?

I am uploading image using jsonapi. But here the data is base64 format (As per requirement). Uploading to media entity. So I need to write a hook media entity pre save so that file uploaded should be ...
0
votes
1answer
14 views

Delete Query Syntax

I am trying to write queries in drupal 8 , I know that I must use the delete() function , however just for testing on my draft I tried the following query and it worked : $connection = \Drupal::...
0
votes
1answer
21 views

How to alter an existing breadcrumb link programmatically?

I am trying to alter the 'Home' Breadcrumb link using hook_system_breadcrumb_alter() The default Breadcrumb class allows you to add New links using the addLinks method. However it does not allow one ...
0
votes
0answers
13 views

How to calculate two taxes for the same product?

Spanish taxes depends on the product but also on the customer. A product could have one of this taxes: normal (21%), reduced (10%) and super-reduced (4%). This is managed by a field on the variation ...
0
votes
0answers
21 views

How do I add an help text icon next to a custom form element label?

I'm trying to add an information icon next to a custom form label. When users hover the cursor over that icon, it should display the label description. I know '#attributes' => array('title' => t(...
0
votes
0answers
25 views

Delete an account without showing the confirmation form

I've been working on creating a feature which allows certain non-admin but higher-than-user roles within a Drupal 8.8 system to delete users from the system. In essence, only admin and 'moderator' ...
1
vote
0answers
69 views

Clearing Cache related to user data

Drupal's cache system is a complete nightmare causing all sorts of issues with my user sessions. To provide a couple examples Our navigation header block contains a link that takes users to a ...
0
votes
0answers
19 views

Order confirmation email with custom order fields

I have added some fields to the order type and they are completed on checkout flow. I would like to include those fields in the confirmation email but I haven't found a way to get it on the twig ...
0
votes
1answer
32 views

Views rest export does not update

I have two websites. On website 1 I have a calendar showing upcoming events. Next to a regular views page I also created a views rest export page with 6, of the most near in the future, upcoming ...
1
vote
0answers
31 views

How can I have the file upload destination private by default?

Currently Webform file component uses public files as default upload destination. This is probably because private files path is not always available if not configured in Drupal settings correctly. ...
0
votes
1answer
15 views

JSON:API error unprocessable entity status 422 entity_id this value should not be null

I'm trying to post a flag with JSON:API but I'm getting the following error: "errors": [ { "title": "Unprocessable Entity", "status": "...
0
votes
1answer
34 views

hook_views_query_alter() not working?

Very new to web development and even newer to Drupal, and I have some questions that I would really appreciate if anyone could answer! Here's my yml file, [Site name] is actually just the name of our ...