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
1 vote
1 answer
65 views

Data is not saved on the entity when the source and destination field names are the same but have different types

I'm migrating from Drupal 7 to Drupal 9. On the source Drupal 7 user entity there is a Text (list) field with various values. These need to be migrated to a taxonomy_term reference field on the Drupal ...
Leo Pitt's user avatar
1 vote
1 answer
70 views

How can I use EntityForm ::save() in a custom module? [closed]

How can i call public function ContactFormEditForm::save. My goal is refer to return value, do something like email, custom logged message, etc. Refer to api."Return value int Either SAVED_NEW or ...
user76445's user avatar
2 votes
1 answer
243 views

How can I properly create separate storage for a base field?

What is the correct and supported way to create a separate table storage for a base field on a custom entity? I tried the answer here, using setCustomStorage(TRUE), but it didn't work, and I don't ...
tonytheferg's user avatar
1 vote
0 answers
25 views

Allow access to Webform form URL only through Ajax

I'm using Webform to create some forms, those forms must be showed in modal through Ajax, and all of this is working good. The issue is that I need URL to the form in order to load the form in modal, ...
mixerowsky's user avatar
  • 1,581
1 vote
0 answers
77 views

User-specific caching, but not necessarily the current user

Background I'm creating a render array that is built for a specific user, from data related to that user. The resulting render array is dependent on the user ID that is passed in, and it will be ...
mbomb007's user avatar
  • 514
1 vote
1 answer
64 views

can a module introduce paragraph types and templates?

I'm building a very complicated paragraph layout with multiple levels of interconnecting paragraph types. At the moment, configuration and template files are all over the place. So, I was wondering if ...
Alimba's user avatar
  • 117
1 vote
1 answer
36 views

Custom access for a web-based custom type

For my Drupal site, I made a custom type named MyCoolCustomType. I'd like to grant access to view this custom type only to certain condition on user role and properties of the custom content itself (...
Ben's user avatar
  • 11
0 votes
0 answers
34 views

Different values in an custom entity field for each domain?

I have implemented the Domain module and added a boolean custom field to a taxonomy entity that is accessible in all three domains: domain1.example.com, domain2.example.com, and domain3.example.com. ...
Md Eqbal Ahmad's user avatar
-5 votes
1 answer
46 views

Is there a place to find a list of good premium/paid drupal modules? [closed]

I have a client that has "deep pockets" and so higher ups are pushing for us to use premium modules so that "the user experience is better for the client". I haven't ever used a ...
Eluchel's user avatar
  • 325
1 vote
0 answers
38 views

How to add the title with a sequence number to inline entity form?

I have an edit form of a custom entity that is passed to the controller: $form = $this->entityFormBuilder()->getForm($entity_quote, 'edit'); This custom entity has the reference field to another ...
antongordon25's user avatar
0 votes
1 answer
132 views

How can I add drupalSettings values with the #attached array?

In D7, we have used drupal_add_js with DrupalSettings for accessing php variables to javascript files, for that we have used in D7 in my custom function like below function custom_function($data) { ...
somasundaram's user avatar
0 votes
1 answer
123 views

Why does core create RSS feeds for taxonomy terms?

Drupal 9.5.8 standard installation; I never did anything about RSS feeds in that website. In Google Search Console, under Crawled - currently not indexed section, I was surprised to come across this ...
user avatar
2 votes
1 answer
84 views

Using Drupal's Core classes as services

I have rather a general question that would help me to undestand using services in Drupal 8+ and when it is worth to do so. I have found a useful method createFromRoute which is part of namespace ...
Adamssef's user avatar
1 vote
1 answer
119 views

Using REST API services to create content with field entity references that do not yet exist

I'm using Drupal 9.4 and trying to create content via the REST API web services where one of the field's in this content is a reference to a taxonomy term that doesn't exists until the current node is ...
Patoshi パトシ's user avatar
1 vote
0 answers
55 views

Modify text for inserted link with CKEditor Linkit plugin

I would like to modify text that is being converted to a link within CKEditor, using the Linkit plugin. Eg. When linking to a Media Document, append the file type and size. I am using ...
Wayne Weibel's user avatar
1 vote
1 answer
101 views

TypeError: realpath() PublicStream.php

After installation of Drupal9 recommended project (using composer), I had this error on the homepage: TypeError: realpath(): Argument #1 ($path) must be of type string, array given in realpath() (line ...
MarkDQ's user avatar
  • 153
1 vote
0 answers
39 views

Find content with missing entity reference

I have nodes that have embedded Media (images) and also links to other content (nodes and media). Through hooks I populate custom fields to store those references, this is a multi-value entity ...
Wayne Weibel's user avatar
0 votes
0 answers
40 views

Node template suggestion based on date field

I am trying to get different templates for events node based on the date of the event. The content type used will be same for both, ie. Event. This is what I have done so far: Created a content type: ...
Farhan Erooth's user avatar
-2 votes
1 answer
44 views

How do I remove duplicate taxonomy field values in the paragraph display mode template?

How to remove duplicate values in this code, if they are in "{{ post.entity.name.value }}"? {% block paragraph %}{% block content %} {% for post in paragraph.field_post %} {% if ...
Владимир Помелов's user avatar
1 vote
0 answers
39 views

Why does libraries-extend not change part of the styles of the module DropzoneJS?

I use the DropzoneJS module. To change to change part of the styles written here: /modules/contrib/dropzonejs/css/dropzone.widget.css I use libraries-extend. In the files of my theme particle I wrote: ...
bimsalrobit's user avatar
3 votes
0 answers
40 views

Can I use pseudofields in anything other than source?

If I use pseudofields in the source property for my custom plugin, they are correctly substituted with the computed values. If I use them in another configuration (as per the example), they are ...
Geat's user avatar
  • 463
0 votes
1 answer
99 views

Creating taxonomy terms via REST API using POST: proper formatting of json?

On Drupal 9.4 here and I want to create taxonomy terms via the api. Is there a good example of what I need to POST to an API end point?
Patoshi パトシ's user avatar
1 vote
0 answers
26 views

How to give ability to create custom NID numbers via API REST post when creating content?

I'm using Drupal 9.4 and I tried to pass in a nid value in my POST via the Drupal api. I'm getting the error: Response: {"message":"Access denied on creating field \u0027nid\u0027."...
Patoshi パトシ's user avatar
-2 votes
1 answer
309 views

Argument #1 ($callback) must be a valid callback, class Drupal\node\Entity\Node does not have a method "getCurrentUserId"

I upgraded from Drupal 8.9.20 to Drupal 9.59. All modules seem compatible (upgrade manager). The site is up and running, but if I try to add new content via node/add/article, this error appears. ...
lolhonk's user avatar
  • 411
0 votes
0 answers
37 views

Why is my javascript settings variable empty in Chrome/Edge, but it works in Firefox?

My javascript file starts like this... var my_global_var; (function ($, Drupal, drupalSettings) { 'use strict'; Drupal.behaviors.myBehavior= { 'attach': function attach(context, settings) { ...
arnoldbird's user avatar
  • 1,079
1 vote
0 answers
117 views

Unable to reinstall Admin Toolbar in modules directory

All my modules are in the web/modules/ directory except for Admin Toolbar which is in web/modules/contrib/. (Why? Long story, legacy site.) Admin Toolbar refuses to update now because of the ...
Chanel's user avatar
  • 95
1 vote
2 answers
100 views

Theming webform element label template for entity checkboxes field

In the webform, I use the Entity checkboxes component, which allows me to display the options I need using Views, depending on the node to which the webform is linked. But I lack flexibility in terms ...
Владимир Помелов's user avatar
2 votes
1 answer
260 views

How to create a QueueWorker and run it without cron

Can someone please help me with an example on how to create a QueueWorker class, add items, and run it inside hook_ENTITY_TYPE_presave() or anywhere in a module file? Basically, what I want is adding ...
Dynamdilshan's user avatar
0 votes
0 answers
52 views

My site is not reading the custom page--user--login.html.twig files I created

I am creating custom user (login) pages for my Drupal 9 sites. I have ensured that the files follow the Twig naming conventions and are in the correct folder: app/web/sites/site-name/themes/our-uikit-...
Eric Sorum's user avatar
3 votes
0 answers
134 views

File can not be copied during migration of media entity

I'm migrating pictures into Drupal (9) media entities (image). System is using AWS S3 for local storage. I have 2 migrations: First migrates external images into drupal's files. It copies files from ...
MilanG's user avatar
  • 499
0 votes
0 answers
61 views

Is it possible to not show extra box by default when Allowed number of values is Unlimited in Text (formatted, long, with summary)?

I have created a long text formatted field with unlimited allowed number of values. But it is giving one extra box as default. Every time user edits the content the empty box will show. That is so ...
Priya Degwekar's user avatar
0 votes
1 answer
130 views

Kernel test throws errors: field not found, and Base table or view not found:

Here's the class I want to test: class Thing { public function foo() { return \Drupal::entityQuery('node')->condition('body', 'blah')->execute(); } } And the test: class ...
naomi's user avatar
  • 1,165
0 votes
1 answer
120 views

Creating content on via REST API using POST: proper formatting of json?

I'm trying to do a POST to create content on my site, but I get an Access Denied for creating field: changed even though I am an administrator role. When I remove the "changed" field in the ...
Patoshi パトシ's user avatar
2 votes
1 answer
101 views

How to create a group of sub tokens off an entity type?

I am trying to create sub tokens in a group off of existing Users token (sometimes referred to as "chaining"). So there are 2 parts to this. Creating the subgroup off the existing User ...
liquidcms's user avatar
  • 1,224
0 votes
0 answers
22 views

My product variation is not shown on the entity form

I have many products coming from a migration. This is working for most of the products, but for some of them, the /commerce/modules/product/src/Plugin/Field/FieldWidget/SingleVariationWidget.php ...
lobafox's user avatar
  • 103
3 votes
0 answers
78 views

Enable a module with sample config that depends on a theme

I have a submodule that provides some prepared configuration via config/install. The goal is to have devs enable that module to get a preconfigured set of content types complete with preconfigured ...
Joseph's user avatar
  • 1,596
1 vote
0 answers
105 views

Running a hook after node save, or another way to get the file name attached to a node

We've a D9 site with a custom module which generates and saves CSS code. It takes the name of the file attached to a node, and generates CSS to set it as the node's background. Initially, I tried ...
Bytech's user avatar
  • 111
1 vote
1 answer
123 views

Get the value of taxonomy custom user field

I am trying to get a taxonomy field in hook_user_insert(). The logic is that if the taxonomy field is selected as none then print warning message along with a success message. function ...
Priya Degwekar's user avatar
2 votes
1 answer
355 views

How to write in a ckdeditor textarea with Cypress?

i'm trying to create a new node in Drupal 9. But all my attempts so far have failed when it comes to writing the body text. The body text is a Ckeditor5 field. I can't write there with Cypress. I ...
leandro713's user avatar
2 votes
0 answers
59 views

Convert an existing entity type to revisionable

I am trying to make an existing entity type (knowledge), from the Knowledge Project, revisionable. I followed these instructions Converting a content entity type to be revisionable. A new table, ...
Binary Alchemist's user avatar
0 votes
0 answers
37 views

People view showing some users multiple times and others not at all

I'm seeing some weird behavior in the build-in People view and I'm going to try to explain it. There are 168 users in my site. If I change the view to show them all (and not paginate), it shows them ...
Delford Chaffin's user avatar
0 votes
2 answers
79 views

How do I programmatically assign a new book when a new node is created?

For a given content type, if a new node is created and no book is assigned, I'd like to create a new book and assign the new node to that book. (some background - that content type is the book cover, ...
commonpike's user avatar
0 votes
1 answer
176 views

What is the meaning of "fields pending deletion"?

I have a Drupal 9.5.3 installation which is not customized in any way; no custom modules or themes. I want to remove the Comment core module but I can't and the reason that is given is: Fields ...
user avatar
0 votes
1 answer
35 views

Converting date in field-created.html.twig

node-created.html.twig to override some html. That works fine. Although the date is being displayed as Thu, 04/28/2022 - 11:39 which I want to be something like May 2, 2023. Is this possible within ...
user108721's user avatar
0 votes
2 answers
39 views

User form twig overwrite breaks after the submission doesn't have the current password

I am overwriting the user edit form using this code. function demetra_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id == 'user_form') { $form['...
pierostz's user avatar
  • 402
-2 votes
1 answer
102 views

Using Webform Submission, update a custom field attached to a user

EDIT: After working more on this, the user cannot be blocked and must be active / authenticated. Using webforms, I have a form that has a field that a new user (blocked) needs to fill out to tell the ...
jasonflaherty's user avatar
-2 votes
1 answer
118 views

Set variable for drupal 9 website [closed]

I need to get the hostname and then define a variable which is going to be used in all controllers of the website. I am able to call the code in controller as follows: $host = \Drupal::request()->...
Saili Jaguste's user avatar
0 votes
0 answers
25 views

How to add "all" option to exposed filter?

I see this discussion for Drupal 7 but am trying to do something similar in Drupal 9. My view is called "content_display" and the display I am trying to affect is called ct_list (see ...
Patrick Man's user avatar
0 votes
1 answer
139 views

Multiple Custom Module Event Subscribers Override Each Other

I've been working on custom modules that alter RequestEvents based on the entity type provided by the route. The functionality from one entity to another doesn't change, but the data does, hence I ...
FrankieD's user avatar
  • 103
0 votes
1 answer
41 views

How to programatically update a field for a revision?

What is wrong with this approach for updating a field value in a specific revision: public function myTest() { $test = 'mytest33'; $node_revision = \Drupal::entityTypeManager() ->...
arnoldbird's user avatar
  • 1,079

1 2 3
4
5
36