Questions tagged [10]
Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.
424
questions
0
votes
0
answers
83
views
Form storage values are not persisted when validation fails
I need to persist some data in a form even when validation fails. The code below (taken from the examples module) works - except for the first time the form is rendered and submitted (and the ...
-4
votes
0
answers
38
views
How can I search for nodes by taxonomy term in the search box? [closed]
Sometimes when doing a search in a Drupal core with the search box, I don't want to search by a mere string but by a taxonomy term (name, not ID), pretty similar to how people normally search by a tag ...
-2
votes
0
answers
62
views
Why D8 site upgraded to 10 runs without errors on local but not on server [closed]
I had a D8 site to migrate to D10. There is a requirement to do so via D9.5, so I tried that. After a full day of various composer-related and Drupal-related issues, I decided to simply recreate the ...
1
vote
1
answer
71
views
How to properly set up caching in a preprocess function for a block variation by node type?
I have a site that uses hook_preprocess_block to add a node content type/bundle variable for a block twig template. The template then has logic to display different HTML depending on the node type.
...
0
votes
1
answer
30
views
Why does removing a language removes body content from nodes in this language?
I have a node in a certain language but I have deleted this language in /admin/config/regional/language and the node body content was removed along with it.
I was expecting that there would be a ...
0
votes
1
answer
33
views
Is there any necessary action regarding nodes of a content type in case I want to change the language of that content type?
I have a content type of language A and I further have one node of that content type, which is in language A as well (no translations).
I plan to change the language of the content type from language ...
0
votes
1
answer
38
views
Theme template not found in module controller
I'm very new to Drupal 10 and I'm having an issue with a custom module I'm trying to create. I have a controller that I'm querying nodes of an FAQ content type that I created. The defined route works ...
2
votes
1
answer
194
views
How do I alter a table by using AFTER in hook update?
I am trying to alter an existing table to add new column. I am able to add new column successfully. But the created new column is added at the end of the table. I want the column to be added after a ...
1
vote
0
answers
23
views
Unable to display errors on AJAX form until next page load
I just started working with Drupal 10 and I'm having an issue with displaying form validation errors with an AJAX form submit. Everything works fine except the display of form validation errors if the ...
-3
votes
0
answers
53
views
How can I execute "SELECT EXISTS" on configuration entities?
I have a requirement to run a query like SELECT EXISTS(SELECT * from ExistsRowDemo WHERE ExistId=104);.
How can I construct this using Drupal query API?
How can this be done in Drupal dynamic query? ...
0
votes
0
answers
22
views
How to get text only debug using devel 5.3.1
I've just upgraded devel to version 5.3.1 and it seems like the devel_dumper setting to just write text to /tmp/drupal_debug.txt has gone away.
How can I use devel_debug() in a way that I can work ...
0
votes
1
answer
81
views
What is the alternative to setting $base_url?
I have spun up fresh instance of Drupal commerce via Composer. The installation is at https://drupal.modhaka.com/web/.
However, few modules like Social Auth are expecting the front page to be https://...
0
votes
1
answer
50
views
Drush fails after moving to another server
Upgraded site from drupal 9.5 to 10.2.2. After pulling update on server with git, everything is fine except for drush. My local machine (8.1.20) and server (8.1.21) both php 8.1, no global drush ...
2
votes
1
answer
51
views
How can I expose paragraph type third_party_settings and other properties on JSON:API?
Paragraph type third_party_settings and other properties are not exposed on JSON:API.
Example:
drupal.com/jsonapi/paragraphs_type/paragraphs_type
or
const paragraphsTypes = await drupal....
0
votes
0
answers
49
views
Paragraph translations - an additional twist
As per https://www.drupal.org/docs/contributed-modules/paragraphs/multilingual-paragraphs-configuration:
I have a node bundle with a paragraphs field. The paragraphs field is NOT set for translation.
...
0
votes
0
answers
15
views
Paragraph with entity browser ajax to wrong URL
I have a drupal node that references a paragraph type. Within that paragraph is a series of fields. One of which field is accessing a "view". So the field looks more like this:
As you can ...
-1
votes
1
answer
39
views
Load jQuery in the head instead of the footer
I need to load jQuery in the header instead of the footer?
I tried adding header: true to global-styling in *.libraries.yml, but this had no effect.
global-styling:
version: VERSION
header: true
...
0
votes
1
answer
21
views
Help on how to upload an image using JSON API with Python
I wrote this Python code. It seems to complain about this error that I don't seem to be able solve. I don't know what this id needs to be (for a new image). If I don't pass the ID, it complains No ID.
...
0
votes
1
answer
67
views
Nested custom field types
I'm trying to nest custom field types. My precise use case is quite complex, so I will try to simplify the problem with a made-up example.
Let's say I create a custom field type named "...
0
votes
0
answers
96
views
Why is Varnish not caching https requests in this configuration?
I'm trying to setup varnish with Drupal10 project, but it's always MISS on HTTPS request but HIT on HTTP requests.
I'm using lando, here is my varnish service simple config.
varnish:
type: varnish:6.0
...
2
votes
1
answer
39
views
In Drush, how to enable path-based language negotiation for emulated requests?
I'm building a path access checker as a Drush command. It would take Drupal's internal path (for example: /langcode/my-path) and user ID and check if the path is accessible, returning a boolean ...
0
votes
1
answer
53
views
How can I add script initialization in the paragraph template and substitute the desired value?
I have a paragraph content builder that has a countdown element. Moreover, this element, like other types of paragraphs, can be added an unlimited number of times. This means that the script must be ...
1
vote
0
answers
42
views
Not getting search results if Views: Exposed Filter search text has html entities
Summary:
Installed Fresh Drupal 10.2.4
No other custom codes or contrib modules.
Added two contents for "Article" content type.
Created a view with page.
Format: Fields
Fields: Title and ...
2
votes
1
answer
40
views
How to validate file uploaded to JSON:API based on the associated field?
I have a custom entity called contact_upload.
The custom entity has an entity reference field called fid, referencing file entities.
I am uploading files to this entity using jsonapi (using the ...
0
votes
1
answer
42
views
Re-using existing field storage
I have an "article" node type, which has a list field article_type with 5 options.
When exporting the configuration, there are two config files:
field.field.node.article.field_article_type....
3
votes
0
answers
81
views
How can CKEditor 5 apply a class on link even when its content is an image
The problem: how to add an option to the CKEditor 5 which can add a custom css style class to a link, even if the content of the link is an image with any alignment? And, of course, preserve the ...
0
votes
1
answer
47
views
Modules missing from "Available updates"
When updating modules (Reports > Available updates) I noticed some of my modules were missing. Upon further investigation i noticed my module info.yml files were missing code
what I currently have: ...
-6
votes
1
answer
98
views
Can I customize pages with mere PHP instead of Twig?
I want to add a year counter at the end of any Drupal page on my website. I could achieve it with the following code to the page.html.twig file in a sub-theme.
<span>{{ 'now' | date('Y') }}</...
-4
votes
1
answer
46
views
Can I add a region without writing Twig myself?
I have a 10.3.1 core with a sub theme in which I customize JavaScript and CSS but not Twig, so can I add a region without writing Twig myself?
This isn't urgent so if it isn't possible with Drupal 10, ...
1
vote
0
answers
47
views
MySQL log files filling disk
I do not know much about Drupal. I have a Drupal 10 installation using MySQL 8.0.37 on Ubuntu 22.04. The Drupal site is the only thing running on this server.
MySQL is filling the /var/lib/mysql/ ...
0
votes
0
answers
36
views
How to get a list of all nodes that have multiple revisions? [duplicate]
Generally, I prevent revisions for all content types, and each node has just one revision. However, I may have made a mistake somewhere along the way; also, I have recently converted the content type ...
2
votes
1
answer
35
views
How to create a node based on the NID of a deleted node?
In the past I have deleted /node/1 but I want to create content in it again instead redirecting from it.
How could I do this in Drupal 10.3.1?
0
votes
1
answer
154
views
"ddev start" won't work "Failed waiting for web/db containers to become ready"
I followed the instructions here and here to spin up a new drupal instance. After running
composer create-project drupal/recommended-project:10.3.1 "PaleFire"
Everything seemed to run fine. ...
0
votes
0
answers
17
views
Reference in inline-block default data
I'm using Layout Builder. In one of the components I use the webform reference field, in order to reduce duplication of webforms I created variants and added a custom select widget to choose between ...
0
votes
0
answers
54
views
"PluginNotFoundException: Unable to determine class for field type 'comment' found in 'field.storage.node.field_comments' "
We were on Drupal 7, and upgraded to Drupal 10 multi-site environment is hosted on Acquia. Since recent launch, Acquia PHP log is displaying this error.
PluginNotFoundException: Unable to determine ...
-1
votes
1
answer
33
views
How to create a view that shows only node titles and nothing else?
Sometimes, a view of teasers or full contents or anything like these data structures is just too much for me and I just want to show node titles (linking to each node).
How to create a view that shows ...
-3
votes
1
answer
58
views
Default taxonomy view doesn't show fields
I am trying to change the default taxonomy term view to include Fields instead Content (teasers) but I get this error:
Display "Default" uses fields but there are none defined for it or all ...
0
votes
0
answers
16
views
Parent Link In Menu Keeps Resetting After a Draft Is Created
Since Upgrading from core 10.1.7 to 10.2.7, I've been encountering a strange issue on the site that I manage. After creating a draft of any page, the parent link drop down keeps resetting to [main ...
0
votes
0
answers
13
views
How to control webform confirmation message modal interactivity
I am using the webform module v6.2.4. On my form, when a user submits the form, they get a confirmation message in a modal window (not using ajax). The modal seems to render with both an "x" ...
-4
votes
1
answer
64
views
How to know what are the longest nodes in my website? [closed]
I want to know what are the longest nodes in my website, preferably by the number of bytes (just as the length of Wikipedia articles is commonly counted in their revision history page by bytes) but if ...
2
votes
1
answer
22
views
File upload field prevents submit handlers from being called
I have a node form that I'm modifying a bit in a form alter hook. I added an additional submit handler:
$form['actions']['submit']['#submit'][] = static::class . '::redirectAfterCreate';
Clicking on ...
1
vote
1
answer
33
views
How do I migrate a list field to a taxonomy term reference field
I am trying to figure out how to migrate a text list field (field_department) in Drupal 7 to a taxonomy term reference field in Drupal 10 (field_team_department). This is what I'm working with right ...
0
votes
0
answers
24
views
Webform Composite Elements Composite won't sort or allow filtering
Webform Composite Elements Composite (such as "State/Province" of "Address") won't sort or allow filtering in a view.
Is there a way to achieve this?
0
votes
1
answer
46
views
Best practice design route for an estimates table
I need to allow users to store monthly estimates so that they can be later retrieved in our management information system.
It would look something like this but with the next 12 months. The first ...
0
votes
0
answers
32
views
capture card number in the order activity of order page dashboard
I'm working on an offsite payment module, wherein I'm trying to capture the card number(last 4 digit) in the dashboard order activity and in payment tab just like stripe module does. For instance, I ...
0
votes
0
answers
127
views
\Drupal::messenger()->addMessage Logs out user automatically
I'm working on a Drupal 10 offsite payment module. I'm trying to show Drupal message whenever order gets placed, declined, or failed. Please see code snippet:
module file: Drupal\my_module\Plugin\...
2
votes
1
answer
280
views
How to prevent emails, api keys hashes, being stored in config and instead use a non-git controlled env-specific settings.php file instead for them
Background
I want to make my site code open source, for reasons of:
collaboration
developing an open source Drupal distribution or module (yes I know distributions might be superseded by recipes but ...
0
votes
0
answers
31
views
Generate order link
I'm trying to generate a link to the order that is displayed on a commerce checkout pane.
$order_link = $this->order->toLink($this->order->getOrderNumber());
$link = $order_link->...
2
votes
1
answer
105
views
How can I fix this code for a "unpublish comment" link on each comment?
I built a custom module for the purpose of providing moderators with the ability to unpublish (or 'unapprove') a comment by clicking a link that appears on the comment.
The module provides the link ...
0
votes
0
answers
47
views
Custom module views-view.html.twig output
I have a custom module that I want to provide certain out of the box functionality, and some of that is going to be pre-generated views inside of a /config folder.
I want to re-arrange some of the ...