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
13 votes
3 answers
1k views

Require v8 only contrib module with v9 patch

Given I have Drupal 9 composer installation with composer-patches plugin and given a contrib module with a stable v8 release, but no v9 release (not even dev branch) and given that contrib module has ...
user avatar
  • 4,909
3 votes
1 answer
324 views

How to properly manage field types for a content type created by a module?

I'm a bit confused about two different errors I get, which seem to contradict each other. I guess I didn't register my field types properly. The first one appears when I try to uninstall my module. ...
user avatar
7 votes
2 answers
5k views

How can I verify users the first time they log in?

I was reading this article. I would like to know how logging in with the REST API in Drupal 8 works. By default, when users log in, Drupal will verify username and password. After the login, the ...
user avatar
  • 726
3 votes
1 answer
340 views

Reverse entity reference lookup

I have a data structure where content type research has an entity reference field scientists. The content type scientists does not have any research reference entity field though. I can get all ...
user avatar
  • 263
9 votes
2 answers
697 views

Use custom content entity theme suggestions in own module?

I have a custom content entity called 'offer'. I've added template_preprocess_offer() and offer_theme() to the offer.module file. function offer_theme($existing, $type, $theme, $path) { return [ ...
user avatar
-3 votes
1 answer
76 views

How can I programmatically add users? [closed]

How can I programmatically add users to an organic group?
user avatar
  • 3
6 votes
1 answer
202 views

What method should I use instead of Drupal\Core\Entity\Query\Sql\Query::addExpression()?

I am using Entity Query to select nodes of two different types. The fetching seems to be working, but I to sort the returned values. Both the content types have different date fields. I know I could ...
user avatar
  • 101
3 votes
1 answer
868 views

How can I use core's WebP support instead of the WebP module?

According to the change record, Drupal 9.2 supports WebP for better image compression. I've been using the WebP module on my 9.1 site to serve WebP images, but it has a performance-killing bug and I ...
user avatar
5 votes
3 answers
574 views

How can I restrict external URLs in link field to allow only certain domains?

After creating a Link field and use the Link with service icon format, I find out that there is no option to restrict external URLs to external domains that I want For example, if I only want to allow ...
user avatar
  • 75
2 votes
1 answer
1k views

Trouble with the upgrade of core 8.9 to 9.2

We are in the process of migrating to Drupal 9, and I am having nothing but problems with composer and trying to get Drupal core updated. I have provided my composer.json file, and a HUGE list of ...
user avatar
  • 161
2 votes
1 answer
355 views

How can I turn off the caching for a Paragraph type?

I'm rendering an array whose URL is dependent on a $_GET variable. Where the variable is present and valid, I want to serve an iframe with the _GET variable as part of the URL. At the moment the cache ...
user avatar
1 vote
1 answer
1k views

drupal9 dev mode local settings : non existing cache.backend.null

In drupal9 my drupal8 local.settings.php conf generate an error when i empty cache Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have [error] requested a non-...
user avatar
  • 2,775
1 vote
1 answer
122 views

How can I fix "Allowed memory size exhausted" on batch finish?

The batch processed all the items, but instead of showing the finish message, I see the error "Allowed memory size of 536870912 bytes exhausted". When I debug the code, I notice that Drupal ...
user avatar
0 votes
1 answer
189 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 ...
user avatar
  • 1,312
3 votes
1 answer
449 views

Disable caching for a front page path processor

I’m working on a project where users can create a book (core functionality). In a simple text field they can connect a domain to this book. This way the book is only accessible via this domain. For ...
user avatar
  • 892
3 votes
1 answer
72 views

How to get Automation testing results of Drupal contributed module through Drupal.org rest API?

I am trying to get automated testing results of contributed modules through https://www.drupal.org/drupalorg/docs/apis/rest-and-other-apis. I am able to get nid and vid of any contributed module ...
user avatar
3 votes
2 answers
165 views

How to not show the "has been created" message? [duplicate]

I want to remove the message that is output in the message area when a new node is created. A typical message may look like this. "Article My article has been created." I examine the node ...
user avatar
  • 14.8k
2 votes
1 answer
834 views

How can I manually upgrade my site?

I have updated my core to 8.9.0, all modules are Drupal 9 compatible and now I want to upgrade to Drupal 9.0.0. I always did my updates completely manually via FTP/web (swap core/vendor/root files, no ...
user avatar
  • 160
1 vote
1 answer
698 views

"Fatal error: Call to a member function setFormClass()"

I am trying to load the node in an external script, and shows me the following error. Fatal error: Call to a member function setFormClass() in field_ui_entity_type_build() The code causing the error ...
user avatar
1 vote
0 answers
25 views

How do I use a hook to modify CiviCRM payment processor details in Webform?

I am trying to use hook_form_alter() to change the details of the CiviCRM Payment Processor for specific users (to change from live mode to test mode). On Drupal 7 it's in $form['submitted'] when Page ...
user avatar
1 vote
3 answers
71 views

ConstraintValidator fails to validate constraint on Taxonomy Term reference field

Client has a simple and consistent hierarchical taxonomy. Cities at the top level and Schools at the second level. . ├── City1 │   ├── School1 │   ├── School2 │   └── School5 └── City2 ├── School3 ...
user avatar
  • 1,939
1 vote
1 answer
280 views

How do I add fields to an existing custom entity? [closed]

I have a custom entity that fieldable. I need to add a field to it, and I want to do it through the UI. The entity was created in a custom module, which I can modify. How can I make the entity ...
user avatar
1 vote
1 answer
11k views

How do I fix an uncaught TypeError? [closed]

I am using Drupal 8.1.8. It is giving me many JavaScript errors. Uncaught TypeError: Cannot read property 'permissionsHash' of undefined Uncaught TypeError: Cannot set property 'StateModel' of ...
user avatar
0 votes
1 answer
446 views

How do I fix a var-dumper conflict?

My upgrade is failing. I am at 8.9.19 and I used upgrade-status to make sure all my modules are compatible with next major core version. I am following instructions at https://www.drupal.org/docs/...
user avatar
  • 399
0 votes
1 answer
117 views

How should I use hook_cache_flush() or hook_rebuild() in a custom module to execute JavaScript code when the cache is cleared?

I'm trying to create a module that executes some JavaScript code when the cache is flushed (via administrator menu or otherwise). I believe I can implement either hook_cache_flush() or hook_rebuild(), ...
user avatar
  • 13
0 votes
1 answer
110 views

programmatically get child nodes referencing parent by entity reference uuid, using loadByProperties & entityTypeManager or other way without views

I tried this answer: https://drupal.stackexchange.com/a/298084/1082 But I can't seem to use 'field_scientists' => $entity_reference_uuid where, in my case, field_scientists is a field of type ...
user avatar
0 votes
0 answers
37 views

How do you add a filter with manage form display?

So I know with form display, you add fields to the content type which then can be re-arranged under form display. But what about more complicated features, like filtering via taxonomy terms? I know ...
user avatar
  • 367
0 votes
1 answer
33 views

Render two taxonomy fields in one alphabetical list

I have two term reference fields: colours and tags. I have a poppy, it has tags: pretty and colours: red, green. I want html like: This flower is: green, pretty, red i.e. I want to take the terms ...
user avatar
  • 3,929
0 votes
1 answer
130 views

Site stuck in 'headers have already been sent' login loop after D9 upgrade

Suggestions for debugging a site which is now stuck in a "headers have already been sent" loop after successful login (redirect back to login form)? This is a production server for a site ...
user avatar
0 votes
0 answers
98 views

How can I list the nodes for which a Boolean value is FALSE or NULL?

On Drupal 9 I have a content type (Article), which has a not required Boolean field, Need Further Review. Its values are TRUE, FALSE, and NULL, where the latter is used when the node doesn't have yet ...
user avatar
0 votes
0 answers
18 views

How to add code that will run on visiting a URL, in addition to another module that also has code that will run on same URL, & control execution order

I'd like to make a custom module that runs code when a URL is visited and then allows an existing module with code that also runs on same URL. So in the case of the existing module that runs on the ...
user avatar
0 votes
1 answer
61 views

How can I solve form "errors has been found" with custom Ajax dependant field and other Ajax fields?

I've altered a node\edit form where there are two taxonomy refence fields with a select widget. I've added a custom ajax callback on the first field, in order to populate the options of the second one ...
user avatar
  • 490
0 votes
1 answer
109 views

Hide path on frontpage redirect

In a custom module i'm using an EventSubscriber to redirect different people to different frontpages. Below is the simplified code I'm using. //GET PATH $nid = 1; $domain_url = \Drupal::service('...
user avatar
  • 892
0 votes
1 answer
221 views

phpwkhtmltopdf engine pdf printing configuration issues

The screenshot below shows my Entity Print configurations for created styled PDFs from node content. As shown in the screenshot I am using the phpwkhtmltopdf engine and the mikehaertl/phpwkhtmltopdf ...
user avatar
  • 1,710
0 votes
1 answer
122 views

How do I migrate body content with [embed]*[/embed] tags?

Currently I am working on migrating a Drupal 7 site to Drupal 9. The nodes in the site has nodes with content similar to the following one. <h3><strong>WHAT WILL YOUR NEXT MEAL BE?</...
user avatar
0 votes
1 answer
262 views

FieldItemList::getValue always returns a string, even for a Boolean field

Supposed I added a custom Boolean field, whose cardinality is 1, to a content type. I create a node of that content type, enter a value for that field (for example, TRUE), and save the node. When I ...
user avatar
0 votes
1 answer
53 views

Add a link to a tableselect row

I'm interested in adding a link in a tableselect form row. Utilizing the #options key I can only add columns with strings. I am able to add form elements in the #options array similar to the #rows ...
user avatar
0 votes
1 answer
39 views

Programmatic webform redirect on submission not redirecting

I have a webform with the confirmation set to redirect to URL (redirects to a custom path or URL) In my webform handler, I have the following: public function confirmForm(array &$form, ...
user avatar