All Questions
87,475
questions
0
votes
0
answers
58
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
0
answers
41
views
Update FieldItemBase database schema
I need to update a default value of column
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return [
'columns' => [
'status' ...
0
votes
1
answer
46
views
User error: "funding_source" is an invalid render array key
This seems to be related to Commerce orders and the Symfony Mailer module. I intermittently see this error when a user attempts to complete the checkout process using Commerce PayPal:
Blockquote
User ...
-2
votes
1
answer
155
views
Cannot upgrade guzzlehttp/guzzle (6.5.8 => 7.7.1) when passing from 9.5.11 to 10.1.5
I am trying to upgrade from Drupal 9.5.11 to 10.1.5. I am also running PHP 8.1.14.
[root@ip-172-31-13-94 demo9]# composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' '...
0
votes
0
answers
44
views
New for/if requirements in twig break bc of additional condition
Our content editors have the option of placing a button block in layout builder with a series of buttons on two rows if checkbox is checked. If checked, the value is "On". This worked in ...
0
votes
0
answers
57
views
Title length error
We just started receiving the following error when attempting to add a new content item: "Title cannot be longer than 70 characters but is currently 79 characters long." This happens ...
2
votes
0
answers
62
views
Media library filtered results are broken after a new media item is added [closed]
After recently updating from Drupal 9.5.11 to 10.1.5 we have spotted some issues with the results displayed in the media library widget.
Basically if I filter results, for example on the string "...
1
vote
0
answers
42
views
Alter the address fields of the address module like adding a placeholder
I made a form with the FormAPI to update the address fields of the address module (with Drupal commerce) and it works well. But I saw a topic where you could generate the form with an address type ...
1
vote
1
answer
131
views
How do you install or turn on CKEditor 5 paste from word plugin
According to a conversation with CKEditor this feature is included in the Drupal 10 version. They do not support it and point you to
Documentation for paste from Word
We cannot find where to turn ...
0
votes
0
answers
72
views
How to create an entity with a referenced entity [duplicate]
I work with Drupal Commerce but my question is more related to a custom entity which refers to a custom entity.
Concretely, users have a profile. This profile contains fields including a field which ...
0
votes
1
answer
73
views
order of role and status on user edit page has changed with 9.5 upgrade
in our 9.3 drupal installation , on the user edit page, the role was before the status. now in 9.5 , the status is above the role. I would like the role to be on top of the status the way it was ...
0
votes
1
answer
71
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
1
answer
64
views
How can I rebuild the cache for a specific route when a node of type foo is updated?
I created a page by a module and the cache of that page must be deleted if a node of node-type 'foo' is updated.
How do I do that?
I read https://www.drupal.org/docs/drupal-apis/cache-api/cache-tags
...
1
vote
0
answers
87
views
Install of drupal/core failed
my installation: > drupal > lando composer install :ended up as seen below, I have run out of ideas what to do with this.
117/118 [===========================>] 99% Install of drupal/...
1
vote
1
answer
69
views
How to get the Drupal webform submission changed value?
I'm trying to get the webform submission changed data when a form submission is updated in date format to be captured into a custom field.
I'm able to get the webform completed value in a custom ...
1
vote
1
answer
30
views
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY error when using drush
This will be less about a question and more of a way to document things. I had been attempting to use drush (Drush 11 and 12) after installing a new copy of Drupal. It kept throwing Error: Undefined ...
1
vote
1
answer
30
views
Include html entities in dynamic menu links
I implemented a class CopyrightMenuEntry extending MenuLinkDefault which provides a custom menu entry (without link) with the current year and the site name.
class CopyrightMenuEntry extends ...
0
votes
0
answers
17
views
Valid date formats for synchronizing unpublish dates
I'm using Feeds to synchronize content. One of the fields I'm trying to sync is the node's unpublish date (we use Scheduler). I've configured the field as a Blank source because I need to manipulate ...
0
votes
1
answer
32
views
Email send not working after symfony_mailer upgrade
I'm trying to upgrade symfony_mailer from 1.x to 4.x. The upgrade went smoothly and the test email button works, but the code we use to send emails is giving this error:
TypeError: Unsupported operand ...
0
votes
1
answer
30
views
Add paragraph fields to a view
I have a content type "view" that has a paragraph attached to it, giving the ability to add a body, image, file, block, etc. I need to create a view for the blog listing that will show the ...
0
votes
0
answers
17
views
View File Uploads in Custom Module Admin Screen
I'd like to show a list of the files in a directory in my default/files directory. This will show's all files:
/**
* Helper function to retrieve and display a list of current uploads.
*/
protected ...
4
votes
1
answer
372
views
How do I add a patch to patches in composer.json from the command line?
In https://drupal.stackexchange.com/a/297530/69441
Third, add an "extras" section in composer with a patch:
How do I do this without an interactive editor?
-1
votes
2
answers
61
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
0
answers
81
views
Why is CloudFlare blocking file uploads?
I have a simple form where people raise IT helpdesk requests (oh, the irony...) and this creates a case in CiviCRM. It's an unsophisticted but cheap helpdesk system for the few requests we get.
A ...
0
votes
1
answer
128
views
Inject a class as depency injection in a service
I just want to inject a custom module class A as a dependency injection for a custom service. I tried but I failed. Can any one please guide me. I'm using Drupal version 10.
Here is my code.
moduleb....
0
votes
1
answer
37
views
Configure new site automatically
Is there a way for me to automate the form-filling steps on a brand new site's /install.php? I'm doing a bunch of experimenting where I set up a site inside a Docker container and try some stuff out, ...
-3
votes
1
answer
60
views
Adding URL redirect showing path http instead of https in redirect [closed]
I have ssl enabled but Adding URL redirect showing path http instead of https in redirect. How we can changes http to https.
0
votes
0
answers
19
views
Email field is not migrated
I am trying to migrate an email field from Drupal 7 profile2 (don't think that matters) and it becomes blank on the Drupal 9 instance. The remaining fields migrate without any issues.
My process ...
0
votes
1
answer
26
views
How do I programmatically disable a filter from a text format?
Suppose I have a text format like full_html and I have an enabled filter with ID my_filter_id.
How can I disable the filter programmatically from full_html.
I needed to put this in an update hook.
...
0
votes
0
answers
33
views
How can one share content and users between two domains without using Domain module?
We have DomainA and DomainB that we want to both redirect to the same Drupal site. Because we want to share content, users, and database.
The reason for this is because we are whitelisting our site to ...
-2
votes
1
answer
88
views
Constantly creating new Anonymous users
I find that my instance of drupal is always "creating" new anonymous users.
I have an even on Create New User that simply logs the name to a file, and it is filled with entries like
2023-10-...
0
votes
0
answers
25
views
How to make autocomplete works with the Japanese language?
I'm working on setting up search with the Search API module and Elasticsearch, for the Japanese language.
Following what described in How to implement Japanese full-text search in Elasticsearch, I ...
0
votes
1
answer
50
views
Configuring dynamic PHPUnit environment variables
Current State:
I'm currently working on running PHPUnit Browser tests in Drupal, and I've successfully configured my phpunit.xml file with these environment variables:
<env name="...
0
votes
1
answer
54
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 ...
0
votes
1
answer
13
views
Promotion options not visible to Editor role
I have a "Editor" Role with limited access rights. It can basically only create blog type nodes.
I'd like to expose to them the possibility to make to publish the node to the frontpage via ...
-3
votes
1
answer
42
views
A complicated question about views, pls help~ [closed]
May I ask how to achieve this requirement? There is a task content type, which has an applicant field, which is multi-valued (that is, a task allows multiple people to apply at the same time), which ...
0
votes
1
answer
21
views
How to move on to the next profile page in views after flagging a profile within the view?
I created a view that current user can use to search/view user profiles. The view lists user profiles and shows one at a time. A profile page can be either flagged “Like” or “Pass” (dating website ...
1
vote
1
answer
67
views
Stylesheets not loading
Has anyone successfully dealt with this kind of error? [Error] Did not parse stylesheet at 'https://*****.***/core/assets/vendor/jquery.ui/themes/base/core.css?s2pf9q' because non CSS MIME types are ...
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 ...
0
votes
0
answers
51
views
TriggeringElement not working properly for my ajax form
<?php
namespace Drupal\demo\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Serialization\Json;
use Drupal\node\Entity\Node;
use \Drupal\...
1
vote
0
answers
48
views
upgrade_d7_file_private failed
i am trying to migrate drupal 7 private files to drupal 9
Step 1 :- i have modified below file
/opt/httpd/htdocs/staging/sitename/master/web/core/modules/file/src/Plugin/migrate/source/d7/File.php
...
1
vote
2
answers
110
views
Should I migrate my site from Drupal 7 directly to Drupal 10, or via Drupal 9?
I have been working through some upgrade issues with a site migration from Drupal 7 to Drupal 10.
In my tests I have been running migrations from Drupal 7 to Drupal 9. I wondered if there is any ...
0
votes
1
answer
49
views
How to hide a region in a node (most preferably without a module)?
I want to hide the sidebar region only in my homepage.
CSS display:none for the sidebar region is not enough because main content won't expand to cover the actual region so I think about using a ...
2
votes
1
answer
51
views
Drupal unable to login and logout several accounts in a single functional test
I am trying to run some functional tests in DDEV that check functions of protected routes. I can log in the first couple of users fine, but after that drupaLogin() fails to generate a logged in ...
1
vote
1
answer
122
views
How to make the “last access time” field visible to anonymous users?
I have configured the user data display to show the last access information, but only me as I have the admin role can see it, anonymous users can not, nor even authenticated users:
So my question is ...
0
votes
0
answers
16
views
Webforms setElementData on checkboxes
Here's a form with two elements: A checkbox field and a checkboxes field.
langcode: en
status: open
dependencies:
module:
- my_module
weight: 0
open: null
close: null
uid: 1
template: false
...
1
vote
1
answer
23
views
Nginx: block access to extensionless LICENSE files
The Drupal Nginx recipe doesn't block access to extensionless files (such as files named "LICENSE"), and it also allows access to LICENSE.md and other files that can be checked to see what ...
0
votes
1
answer
97
views
Why does Ajax prevents managed_file to be displayed?
I have this form
created by this code:
public function buildForm(array $form, FormStateInterface $form_state, $contractId = NULL) {
some initialisation code...
$database = \Drupal::database(...
0
votes
0
answers
31
views
Why does a custom matcher cause a linkit profile to be deleted on module uninstall?
In a custom module, I've set up a custom EntityMatcher in order to get suggestions for instances of my custom entity type in the linkit dialogue. This all works very fine.
However, when uninstalling ...
0
votes
1
answer
96
views
How to return failure with an event subscriber?
I have an event subscriber that deducts a credit when someone makes a booking. If there are no credits left, how do I return a failure and stop the booking being made?
The subscriber is acting on ...