Drupal Answers Community Digest

Top new questions this week:

EntityQuery where multi-value field contains a value

I've been programming for 15 years, 10 with PHP, but on my 1st Drupal project. Using Drupal 9. I'm trying to retrieve an entity (custom content type) that has 2 multi-value entity (user) fields. If ...

asked by Ed Coakley 2 votes
answered by sonfd 2 votes

Why can't some fields be moved within details element?

I am trying to move 2 form fields to the advanced sidebar: dismissible and status. Status was already part of the meta container and setting #group='meta' on dismissable also placed it there; but ...

8 forms  
asked by liquidcms 2 votes
answered by Clive 2 votes

Filter view based on current user's role and taxonomy terms

I have three content types. Article Basic Page Custom Page All the content types have a field_interests field, which can have multiple values, and which is an entity reference field to the interests ...

asked by Steve Siddu 1 vote

How to implement TrustedCallbackInterface

I'm maintaining a module that I've had a 3rd party dev build for me. I D9 this issue has appeared when using the module that otherwise works in D8 and should be compatible with 8 & 9. The module ...

asked by Kristoffer Rom 1 vote
answered by anonymous 4 votes

How to build core test database?

Fifteen years writing Drupal code and yet I have never written unit tests. I have recently posted a couple core patches which require tests to be written for them - so good time to learn how to write ...

9 testing  
asked by liquidcms 1 vote
answered by Christoph Burschka 0 votes

What's the equivalent of drupal_build_css_cache()?

Our client uses an external website for some of their pages. This provider does not enable us to theme their website directly, but they do allow us to load a single JS file from the Drupal site that ...

8 css-js-aggregation  
asked by Geat 1 vote
answered by anonymous 2 votes

How to use migrate process plugin concat on multiple values?

I am trying to import from a csv that has multiple files in the same column, e.g. title,gallery,tag node1,img1.jpg|img2.jpg|img3.jpg,2 node2,img4.jpg,2 node3,img5.jpg|img6.jpg,3 I need to prepend the ...

8 migration plugins  
asked by jofitz 1 vote
answered by Hudri 1 vote

Greatest hits from previous weeks:

Hide a field label

Is there a way to hide the field label when rendering a custom field in Drupal 7? In my node template I have: <?php print render($content['field_image']); ?> Which gives me: <div class="...

7 theming entities  
asked by Ben 21 votes
answered by googletorp 24 votes

How to programmatically trigger a click on an AJAX enabled form submit button?

I'm trying to programmatically (with jQuery) trigger a click on button with AJAX behavior in a Drupal form, but so far jQuery('#edit-submit').click() doesn't do anything. A real mouse click on that ...

7 ajax javascript  
asked by Daniel 28 votes
answered by Daniel 46 votes

Check if a user has a role

How can I check if a user has a certain role? I found this but it is for Drupal 6.

7 users  
asked by giorgio79 46 votes
answered by marcvangend 92 votes

How do I get the raw field value in a twig template?

myfield is a plain text field. {{ content.field_myfield }} renders the field with HTML markup and the field label. How do I render the raw value of the field? {{ content.field_myfield.value }} doesn'...

8 theming  
asked by Pim 37 votes
answered by No Sssweat 65 votes

How can I automatically upload images on file selection rather than pressing the upload button?

I have a custom content type to allow users to upload images. I'm trying to keep the interface as simple as possible. The content type contains a single image field. This works, but some users don'...

7 media  
asked by Patrick Kenny 53 votes

How should I implement hook_menu()?

What are the fundamentals of implementing hook_menu()? I would like to see the basics covered in a single question, to avoid having to answer the same similar but different questions over and over.

7 routes  
asked by Letharion 106 votes
answered by Letharion 152 votes

Get all nodes of given type

I would like to get all nodes that are of my_custom_type type in Drupal 8. I know I can get all the nodes (of any type) with \Drupal\node\Entity\Node::loadMultiple() and the list of all types by \...

nodes 8  
asked by PolGraphic 30 votes
answered by Shawn Conn 53 votes

Can you answer this question?

How can I let users select existing media entities in a webform?

I am a beginner in drupal and I am creating a course form I would like you to help me with a field in the webform. I need to add a field where users can add an image and documents but from the files ...

media webforms  
asked by Yusmely Mejias 1 vote
You're receiving this message because you subscribed to the Drupal Answers community digest.
Unsubscribe from this community digest       Edit email settings       Leave feedback       Privacy
Stack Overflow

Stack Overflow, 110 William Street, 28th floor, New York, NY 10038