Latest Drupal related questions

Score: 0
How to stop duplicates caused by date range in views
eg flag

On my site I have a content type called Course. Courses can have several sessions. To display these sessions I am using the date range.

When a course has more than one date range entered an instance appears in the view for each start date.

How do I only display one instance for each course? There is only one course, even though there are multiple sessions.

The Distinct option in Query settings doesn't  ...

Score: -2
Why is Docker needed for DDEV?
ke flag

I need to establish a Drupal development environment on Windows 10 and I consider DDEV.

I read that DDEV requires Docker but I never worked with Docker. Why is it required for DDEV and should I master Docker itself before developing Drupal on DDEV (or any similar software for that matter)?

Score: 0
How to get user custom field in order email twig
ls flag

I am trying to add user custom field in order receipt pdf using below file commerce_purchase_order under template.


I tried below code

     {% for order_item in order_entity.getItems %}
       {{ order_item|commerce_entity_render('field_custom_fielname') }}
     {% endfor %}

Also Used but this will not work as this is not field in order

Score: 0
SomebodySysop avatar
create views filter from sql
gb flag

I've been trying to create a view that gets all nodes that are in moderated "draft" state as created by the group content moderation module. The current views content state filter will not work. The module has a patch, but this patch requires giving a user site-wide content revision permissions, and we only want to give those permissions on the group level.

I wish to create my own views filter f ...

Score: 1
user3713929 avatar
Issues with beans in the migration (some nodes don't migrate, some migrate old revisions)
th flag

I am trying to do a migration from Drupal 7 to Drupal 9. Most seems to migrate okay but I noticed the following problems:

  • I am missing some nodes
  • Some nodes migrated only old revisions of the node (IE: In the live site a node has 8 revisions, and the migration only migrated the first 2, leaving the most recent of the 2 as the live content, which is a review from 2015. The most recent review in the sit ...
Score: 0
Overwrite a specific VBO action processed message
in flag

I am using VBO to perform bulk operations on my view. I have 2 core VBO actions and 2 custom actions.

  • Publish comment
  • Unpublish comment
  • Publish resource
  • Unpublish resource

When the Apply action button is clicked with none of the grid row is selected, I get this error message.

Select one or more comments to perform the update on.

I would like to rewrite this error message as An attachment has to  ...

Score: 1
jfc avatar
Can I choose specific nodes to show in a view?
us flag

I have a Drupal 9 site with a view that shows products, but I do not want to show all products, I only want to show a select few of them.

Is it possible to filter like this? Instead of showing all the products?

Ideally I'd like a UI where I can manage the products manually. E.g. if I have 5 products but only want to display Product 1 and Product 4, I can select those 2 products.

Score: -1
user888 avatar
emailing the webform's submission values in a table
ph flag

I have been trying to email the submitted values via email handler every time an user submit a form. I have added on custom body so the submitted values would be in the table formally, but the table is all broken as you can see on the photo. Is there a way to fix the problem? Thank you in advance

Here is what I added on the custom body:

        <th>D ...
Score: 0
How to make pagination for php data inside preprocess_paragraph_HOOK
ru flag

I have data coming from External Entity (MongoDB) and I need to make pagination inside hook theme suggestion of a paragraph :

code snippet

Is there a way to use built-in pagination of Drupal in this scenario? thanks!

Score: 0
Altering user_admin_account and user_register_form
ro flag

I'm pretty new to Drupal and I'm trying to build a Drupal 7 custom module to alter the user listings table in admin/people. I would like to display the first and last names of the users. I've already added the text fields to the user registration form in admin/config/people/account-settings/manage-fields and I've managed to store the user input in my database table. I've added the extra fields to the us ...

Score: 2
Lambic avatar
How do I switch user account in drush to test permissions?
ph flag

I'm playing around with the D9 Groups module and I want to test the access control in drush, either using drush php or writing a script and using drush scr.

In drush 8 I would always use drush -u to run as a specific user but that option seems to have disappeared in drush 10.

What's the easiest way to either run drush as a specific user or switch the user in drush php or a script?

Edit: I'm working aro ...

Score: 0
Matoeil avatar
hook_cron triggered manually but not automatically
za flag

That hook cron below is executed when i manually trigger the cron but is not on a regular automatic base (every 3h).

How can it be ?

function my_module_cron() {    
  \Drupal::logger('my_module')->notice('entering hook_cron');
  //some more code
Score: 0
jmzea avatar
How can I give access to shipping information to authenticated users?
br flag

As administrator when I visualize the page for the order of a user (user/[user-id]/orders/[order-id]) I can see the shipping and billing address.

But setting the same type of information for authenticated users that are not administrators, the addresses are not shown in the summary of the order, despite I have modified the display of the order for users (/admin/commerce/config/order-types/default/ ...

Score: 0
Search API views is displaying empty pages
kr flag

My search page is displaying results. The pager is displaying. But the first 15 pages display no results and then on the 16th page, I can see the content.

I have deleted all the data from the index, and re-index the data again but no effect. Can anyone tell me why the first 15 pages are empty? and how can I fix it?

When I print the results in hook_search_api_results_alter, it is something like th ...

Score: 1
How to filter webform by custom field "ThirdPartySettings"
de flag

I've created a new field for all my webforms called "color" inside of settings (this field is only for CMS users)

To create this I used "ThirdPartySettings" like this:

It's ok. But now inside of /admin/structure/webform I need to create a filter with this field.

Example: to show all webforms with "color" = "bl ...

Score: 0
Jorn Reed avatar
How to show a field in a view for another field?
il flag

I have twig template named views-view-field--banner--block_1--field-banner.html.twig Here I print <a href="">{{ output -}}</a> To put an anchor tag around an image field named field_banner. I also have another field named field_slider_banner_link that I want to print within the href="". But I have no clue how to get the value from that other field into this template.

Score: 0
Is it possible to use WSL-based Drush on a Windows 10 XAMPP and if so how?
mu flag

I currently use Drupal 9 but concepts about Drupal 10 may be useful.

I use Windows 10 Home with XAMPP and C:/xampp/htdocs is my web application root.

I want to establish a minimal Drupal development environment on my Windows 10 Home instance by installing Composer and then Drush.

I can use WSL to install both Composer and Drush but then a question arises:
If WSL only effects its own Linux environment, ho ...

Score: 0
Jhon Manny Loto avatar
IP Restriction on a admin pages
gb flag

Currently I'm working on how to restrict the admin pages on a certain IP. I'm using Drupal 9 version This is what I put on the htaccess

<Location "/admin/dashboard">
  Order deny,allow
  deny from all
  allow from
  allow from

but it is still not working. Is there any suggestion on how to fix this one. Thanks in advance.

Score: 0
pglatz avatar
Route reported as not existing, but I'm not referring to it
in flag

Drupal 9.28; I removed some test code, and am now getting the error

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "member.test" does not exist." at /Users/pglatz/dev/wdocs/wdocs-d9-code/www/web/core/lib/Drupal/Core/Routing/RouteProvider.php line 206

I grepped my code and there is no longer a reference to member.test in any of the yml files (or anywhere el ...

Score: 1
tis avatar
How can I programmatically render the summary of a textfield?
br flag

I can output a textarea field with the following code:


How do I need to change that code for getting the summary of that field?

(Where can I find a documentation of that view-function?)

Score: 0
How do I configure Scout APM?
cn flag

Their docs have setup instructions for Symfony, but I'm not sure how they translate to Drupal: Could anybody provide some insight on how the xml/bundle instructions work in a Drupal context (if they do)?

Score: 0
Samuel Fernandez avatar
The tag is replaced by '*' character
ng flag

While sending out html emails that are configured to use the following template.

<p>Submitted on [webform_submission:created]</p>
<p>Submitted by: [webform_submission:user]</p>
<p>Submitted values are:</p>

The actual value returned is the following one.

*First Name*
*Last Name*
*Email* [1]
*Plea ...
Score: 0
Lambic avatar
Custom entity access control based on group membership
ph flag

I am using the group module in Drupal 9 to control access to content by user groups.

I have a custom entity defined as a single table unfieldable entity. The entity has a "group ID" base field defined.

I want to add an access controller that checks if an entity is associated with a group the user is a member of.

Is there a simple way to do this, or I do I need to go down the rabbit hole of creating a g ...

Score: 0
C.A. Vuyk avatar
How can I debug cache tags not invalidated as expected?
cn flag

Up unto last week my Drupal site and varnish_purge worked together fine with Varnish. After updating the modules to the latest versions, cache tag invalidation seemed to stop. Nothing else really changed in the meantime. In /var/log/varnish/varnishncsa.log I get messages like the following. - - [16/Nov/2021:09:04:13 +0100] "BAN HTTP/1.1" 200 254 "-" "varnish_purger m ...
Score: 0
yuuuu avatar
Programmatically getting variation type fields in order
ao flag

I am trying to get variation type field values from the order entity but I can't find any documentation on this. I am using an event subscriber to run the following code when an order is paid. The code works, but I can't see any reference to the fields in kint and I can't find any references to any kind of "getVariation" or equivalent function online.

 * This method is called when the commerce_or ...
Score: 0
Joost avatar
Restore menu items using database backup
jp flag

When working on a site I accidentaly removed all my menu items I now want to recover them from a database back-up I have. Is it enough to just copy all data from these tables from the backup to my sites database?

  • menu_link_content
  • menu_link_content_data
  • menu_link_content_field_revision
  • menu_link_content_revision
  • menu_tree
Score: 0
Order item - title missing product attributtes
ng flag

i'm placing a manual order, and when I search for a product, I have only the sku and the title, but with that I don't know the size for example or the color, as they are attributes, how can I do to have those information in the autocomplete, see image. order item autocomplete enter image description here

Score: 1
bdereta avatar
Custom node routing
cz flag

I have a product content type with alias: /products/headphone. This product page has two url variations:

  • /products/headphone/wire
  • /products/headphone/wireless

Both urls should point to the same node, however within preprocess function or twig, I should be able to capture which variation is loaded (wire|wireless)

I figured I should create a custom module and handle custom routing:

my_module.routing.yml: ...

Score: 0
user3038672 avatar
Extending block, a block with a paragraph field, and 3 paragraph fields... how to loop through the paragraphs from the block extension
cn flag

This is what I have:

I have three twig files:

  1. block--paragraph-images.html.twig (which extends block.html.twig)
  2. field--field-paragraph-image-block.html.twig (the paragraph field which is located in the custom block type, block--paragraph-images.html.twig.)
  3. paragraph--field-paragraph-image.html.twig (which houses three fields: field_paragraph_image, field_paragraph_title, and field_paragraph_text ...
Score: 0
fallenturtle avatar
Message Subscribe is ignoring flag and sending notifications to everyone
au flag

I'm developing a Drupal based forum and I'm using the Message stack modules combined with a tweaked version of this custom module. The idea is that all users get an email when a new thread is posted, but only users to subscribe to a thread get notification for comments left in that thread. The part where people get emails for new threads is working, bu ...

The Stunning Power of Questions

Much of an executive’s workday is spent asking others for information—requesting status updates from a team leader, for example, or questioning a counterpart in a tense negotiation. Yet unlike professionals such as litigators, journalists, and doctors, who are taught how to ask questions as an essential part of their training, few executives think of questioning as a skill that can be honed—or consider how their own answers to questions could make conversations more productive.

That’s a missed opportunity. Questioning is a uniquely powerful tool for unlocking value in organizations: It spurs learning and the exchange of ideas, it fuels innovation and performance improvement, it builds rapport and trust among team members. And it can mitigate business risk by uncovering unforeseen pitfalls and hazards.

For some people, questioning comes easily. Their natural inquisitiveness, emotional intelligence, and ability to read people put the ideal question on the tip of their tongue. But most of us don’t ask enough questions, nor do we pose our inquiries in an optimal way.

The good news is that by asking questions, we naturally improve our emotional intelligence, which in turn makes us better questioners—a virtuous cycle. In this article, we draw on insights from behavioral science research to explore how the way we frame questions and choose to answer our counterparts can influence the outcome of conversations. We offer guidance for choosing the best type, tone, sequence, and framing of questions and for deciding what and how much information to share to reap the most benefit from our interactions, not just for ourselves but for our organizations.