Questions tagged [9]

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
1 answer
390 views

Show a summary calculated from webform submitted values on the submission preview page only (not on form) and re-use in e-mail handler

We need to display a computed summary of submitted information on both the submission preview page and in e-mails that are sent out. I'd expect this is a common usecase and wanted to check if i'm ...
0 votes
1 answer
131 views

Why the form does not save data from the entity reference field?

I have a custom entity (with the name Entity Quote), from the add form of this entity I make a multistep form. In the custom entity Entity Quote, I added another custom entity (with the name Quote ...
0 votes
1 answer
66 views

How to dispatch a ResponseEvent so that a cookie is added after login?

I want to add a session cookie when a user logs in. The previous implementation I had, was setting the cookie in hook_user_login with this snippet: $response = new Response(); $response->headers-&...
0 votes
1 answer
1k views

Build custom form with entity form field

I have a feature to migrate from Drupal 7 to Drupal 9. This allows me to build a custom form made up of static fields, which I define in the code of my module, and fields dynamically retrieved from an ...
0 votes
0 answers
64 views

Error in Programmatically Creating Paragraphs with Layout Paragraphs

I am trying to programmatically create paragraphs using the Layout Paragraphs module. However, I'm encountering this error when saving the main entity that contains these paragraphs. I'm looking for ...
1 vote
1 answer
556 views

Get third party settings in paragraph node edition

I'm adding a third party settings in my .module file, in the mymodule_form_alter function. I did this is order to add an image to my paragraph. function my_module_form_alter(&$form, ...
0 votes
1 answer
1k views

How to configure a custom POST api to accept a request with Content-Type as "application/x-www-form-urlencoded" in the header?

I created a controller in a custom module that accepts a POST request. I have a setup such that I get a POST request from a third-party application server to this API. But the POST request has a ...
0 votes
1 answer
32 views

I cannot install Geocoder

I have tried to install Geocoder v4.11 with composer require 'drupal/geocoder:^4.11' --with-all-dependencies, but instead I get incompatibility issues with Guzzle. Problem 1 - php-http/guzzle7-...
0 votes
2 answers
50 views

Adding a default text [closed]

Option 1: Is there any way to write a conditional in Twig that if field1 in Drupal is empty, I can set a default text to say "Bye" Option 2: I was also trying to use the conditional fields ...
0 votes
1 answer
462 views

Warning: file_put_contents(): Filename cannot be empty

After updating Drupal 8 to Drupal 9, the following error is displayed on the website page: Warning: file_put_contents(): Filename cannot be empty in /var/www/html/web/modules/contrib/devel/src/...
2 votes
1 answer
256 views

Why is MethodNotAllowedException thrown when an image is uploaded with CKEditor 5?

After updating Drupal to 9.5.3, I had this warning: Deprecated modules found: CKEditor. So I upgraded from CKEditor to CKEditor 5 following this documentation. After some setup on text formats, I made ...
-3 votes
0 answers
34 views

How to make Drupal 9/10 friends with Sendpulse and other mailing services? [closed]

There was a task to send data from the site to the address book of the Sendpulse mailing service. I have a type of material where there is a name and email field. It is necessary that when creating a ...
0 votes
1 answer
37 views

How do I take the value of a variable from the node template and insert it into the field value?

In the template of the material type node there is a variable that adds and multiplies integers according to the formula, which I take from the filled fields of the node. Everything is working ...
2 votes
2 answers
2k views

Form with two submission buttons

I try to create a form with two submit buttons and each button will use a different function: the default submitForm function and a custom submitFormEndSession function. So I have this code: class ...
-3 votes
1 answer
94 views

I am trying to install Drupal Commerce, I get error that prevents installation, I don't get what it says about ../private folder [closed]

Can somebody specify where this folder should exist? I created it in the directory containing the vendor directory, in the files directory, outside of the files and in the site root directory, but I ...
0 votes
1 answer
639 views

Use ajax to save modal / dialog form instead of page reload

I'm looking for a way to save modal & dialog forms through ajax instead of redirecting the user after the form submit. Ajax is quite unknown territory to me. I've found several interesting topics ...
-1 votes
1 answer
123 views

How to remove exactly normalize.css that comes from core (not anything else)? [duplicate]

I tired libraries-override: core/normalize: css: base: assets/vendor/normalize-css/normalize.css: false misc/normalize-fixes.css: false or libraries-override: system/...
1 vote
0 answers
25 views

How does the RDF module impact user mapping when using the Acquia Migrate Accelerate (AMA) tool?

Before Acquia's AMA tool was open source, I used it on their platform to upgrade from Drupal 7 to Drupal 9. I am in the process of upgrading to Drupal 10 and want to uninstall the RDF module (don't ...
-1 votes
0 answers
32 views

How to use the Tableselect element for an order-able list of items?

It's been a minute since I have used tableselect. I want to present a user with a list of sortable options that have checkboxes to indicate they are on or off. See this screenshot: While the table ...
0 votes
1 answer
117 views

How can I programmatically save node components?

There is a site with number of nodes including layout canvas and site studio components available in a node. When there will be changes in one of the components (new field added with default value), ...
0 votes
1 answer
1k views

How to set default value for entity reference programmatically in a form?

I have a custom form that I created programmatically. $target_type = 'node'; $selection_handler = 'default'; $selection_settings = ['page']; $data = serialize($selection_settings) . $...
-1 votes
0 answers
24 views

Email no longer received as HTML after switching to PHP 8.1

I am using Drupal 9 and SMTP module to send email. When my Linux server was on php 7.4 this worked fine. After switching the server to php 8.1 the email no longer sends as HTML and the From mail ...
1 vote
1 answer
400 views

Installing the dependencies of local modules without composer merge plugin

Currently I have a composer-based Drupal project with both third-party and custom modules. Third-party modules are managed by composer without any issues. But I would like my custom modules to declare ...
1 vote
0 answers
30 views

How do I always show full search result pages in cases where some results are removed due to access restrictions?

I have a solr search index set up and a view to search content. We have "Region" groups for members so they only see content from their region. The search works great as admin who has access ...
0 votes
3 answers
1k views

How to set widget for a field on a custom form?

How do I set the widget to be used for a field on a custom form? I am surprised I haven't been able to find something covering this. Sort of expected it to be something like: $form['interest'] = [ '#...
0 votes
1 answer
926 views

doctrine/reflection conflicts with doctrine/common

My current Drupal version is 8.9.3, running on PHP 7.3.20, and updated from Drupal 8.9.2 (fresh install) using compose update. I tried to upgrade to Drupal 9 used this https://www.drupal.org/docs/...
-2 votes
2 answers
485 views

After I upgraded the site, some admin pages get a "Field storage definition for 'uuid' could not be found." error

Upgrading Drupal 8 to Drupal 9 went smooth and without any issues, but now when I visit admin/reports/status or admin/modules/uninstall, I get this exception. Drupal\Core\Field\FieldException: Field ...
0 votes
1 answer
412 views

How to list content that references another content type through paragraphs

I have two content types: "Author" and "Document." The Document content type uses a Paragraph "Author_citation" to connect the two and display all the authors (plus other ...
0 votes
0 answers
36 views

Trusted host patterns problem, again

I need to set up trusted host patterns for 3 EC2 instances. They all share same base code, so they all use the "same" settings.php. On my two (production) instances everything works fine: ...
0 votes
0 answers
33 views

Is there any way to use EntityQuery on entity_reference fields in reverse?

Let's say I have two custom entity types: entity_one, entity_many. I know how to use an EntityQuery to find entity_one matches if there is a multi-value entity reference field on entity_one. $results =...
0 votes
3 answers
82 views

How can I have updated content entity data immediately available after update?

I created custom content entities to handle a small NGO membership (Member, Person, both linked to Drupal 'users'). I have a form allowing users to perform online membership application. Submitting ...
2 votes
2 answers
324 views

Edit index config (Search API) programmatically and get the status index updated

I have a site with 14 pieces of news and 44 basic pages. I have created an index (Search API) with this bundle: and this is the index status (the content is already indexed during cron): When I ...
1 vote
1 answer
99 views

How to make media description show on form view when used as entity reference

Drupal 9... I have a content type of "Resource" which uses a field "download" which references the media type "document", but when I upload a file to the field, it gives ...
0 votes
1 answer
866 views

How do I programmatically alter the links displayed in the main navigation menu?

The main navigation menu in the site I am currently working on has a lot of menus. I want to hide the disabled ones. I figured out that it is rendered via the menu_edit_form form. entity.menu....
0 votes
2 answers
1k views

How can I use contextual filters to display a block with field values from a single related entity?

I've found various recipes/threads with the scenario where have a content type A node and want to display in a sidebar block, all the related content type B nodes, with the relationship based on an ...
1 vote
1 answer
414 views

Get the node title field value in the form_state

Drupal version 9.3.9. This is a process of Ajax callback, where the value of the title field is required. In the form node add, the title is displayed. It seems that the form_state does not apply to ...
0 votes
1 answer
642 views

REST API OAuth Authorization and Authentication

I am very much confused about the way OAuth authorization and authentication works in Drupal 8/9. Let me put my points first, please correct me if I am wrong. Authorization is when an entity proves a ...
1 vote
1 answer
563 views

How can I set a default value to show for a taxonomy term name in its edit form?

I have a site where I have a taxonomy term. I want to set a default value to the term name and display it when the form loads. In hook_form_alter(), I tried to set the default value to Check term name ...
0 votes
1 answer
117 views

Why is my message not showing for anonymous user?

In a custom form, I have this Ajax submit: public function ajaxSubmit(array &$form, FormStateInterface $form_state) { $response = new AjaxResponse(); if ($form_state->hasAnyErrors()) ...
1 vote
1 answer
1k views

How do I programmatically set the default value of an exposed filter?

I seen many answers for Drupal 7, but I can't find any information for Drupal 9. In hook_form_alter(), $form['field_assigned_location_target_id']['#default_value'] = '553'; doesn't alter the default ...
0 votes
1 answer
465 views

How to use sql MAX() function in views plugin query

I am creating a custom views filter for a custom views field. The following SQL will accomplish the filter I seek: select nid, moderation_state, content_entity_id, MAX(content_entity_revision_id) ...
1 vote
1 answer
660 views

Multiple forms on page

I am trying to get multiple forms to work in a views display. All of the forms uses AJAX, but they appear to be interfering with each other. One form is the Views Bulk Operations form that turns the ...
1 vote
0 answers
55 views

How can I have both file download and redirection in for submit?

I have this form submit: public function submitForm(array &$form, FormStateInterface $form_state){ // File download $sFileName = 'JdP-Adhesion.pdf'; $sFileNameWithPath = 'sites/default/...
0 votes
1 answer
73 views

Can create directories but can't upload files

When I try to upload a file with a file field, Drupal creates a sites/default/files/2023-10 directory, but can't upload the file. I see this validation error in the UI: "File upload error. Could ...
1 vote
2 answers
1k views

Symfony Routing Error

My site has completely gone blank after updating modules with Composer. This is the error I get. I've found some similar errors in a topic from the past, but they are all about earlier version of php ...
-1 votes
2 answers
62 views

How to add a link to table row?

There is a field 'field_upload_artwork' that contains files. I am using them to build links to files and want to insert links after Apparel Printing in the last step of the form. Now the markup in ...
0 votes
1 answer
228 views

Query to fetch users with specific roles

I'm using the following code. $query = \Drupal::entityQuery('user'); $query->condition('uid', [302,330], 'IN') ->condition('status', 1, '=') ->condition('field_membership_status....
1 vote
1 answer
552 views

Change weight/order of exposed filters

I have a view with two exposed filters: one generated using the Views UI, and another filter from custom code. Can I change the order in which the exposed filters are rendered on the form? I could not ...
0 votes
1 answer
55 views

Why doesn't my completion message show?

I have this form to handle a custom content entity: created by this code: public function buildForm(array $form, FormStateInterface $form_state, $contractId = NULL) { Some code to inialize ...
1 vote
1 answer
33 views

How to add extra validate hook to the order information form?

I am trying to collect additional information on checkout to add to the order. I have added new fields to the order entity and then used hook_form_commerce_checkout_flow_multistep_default_alter to add ...

1
2 3 4 5
36