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
12
votes
3answers
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 ...
3
votes
1answer
176 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. ...
8
votes
2answers
341 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 [ ...
0
votes
1answer
122 views

How can I debug a Twig error that occurs after migrating from Drupal 8.9 to Drupal 9+

I am trying migrate my Drupal 8.9 site to Drupal 9+ and I am stuck with an error its cause I am not able to hunt down. On almost every page I get the following PHP exception: Twig\Error\RuntimeError: ...
14
votes
2answers
9k views

Load a file entity by URI

Is there a way to load a file by URI in Drupal 9 and/or Drupal 8? In Drupal 7 it is possible using the following code. $uri = 'public://file.xyz'; // Take a look at: file.inc::file_load_multiple $...
6
votes
1answer
124 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 ...
3
votes
1answer
365 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 ...
5
votes
3answers
341 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 ...
2
votes
1answer
153 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 ...
1
vote
1answer
404 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-...
0
votes
1answer
103 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 ...
3
votes
1answer
70 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 ...
3
votes
1answer
215 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 ...
2
votes
1answer
625 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 ...
1
vote
3answers
61 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 ...
1
vote
0answers
19 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 ...
1
vote
1answer
419 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 ...
1
vote
1answer
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 ...
0
votes
1answer
42 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 ...
0
votes
1answer
102 views

Creating a custom module caused "The website encountered an unexpected error. Please try again later."

Drupal 9.2.7 on XAMPP 7.3.29 , 7.4.21 on Windows 10 Home. I tried to create a custom module which allows global JavaScript and CSS (effective in all webpages in my website), by creating the directory ...
0
votes
1answer
60 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/...
0
votes
1answer
35 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 ...
0
votes
1answer
150 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 ...
0
votes
0answers
59 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 ...
0
votes
0answers
17 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 ...
0
votes
0answers
18 views

How do I 'subscribe' to user event creation, so I can run my own code when a user is created? [duplicate]

In Drupal 7, this was done with a hook. And there also seems to be a hook available in Drupal 8/9: 8 - Drupal 8 hook into registration Is this still the way to do it or is it being deprecated and ...
0
votes
1answer
98 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('...
0
votes
1answer
134 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 ...