Latest Drupal related questions

Score: 0
Berry Dingle avatar
Entity Browser Modal closes on Exposed Filter Submit Button
cn flag

I've set up a commerce shop that uses Entity Browser to select product images. I set up a view to display the selectable images which has an exposed filter for the filename, so the user can search for the name of an image and then select it.

The entity browser works as desired, but if the user clicks the "apply"-button of the filter, the modal closes. Same behaviour with an iframe as well.

When I se ...

Score: 0
cocq avatar
How to save a ajaxified value in a form
gb flag

I add a ajax callback to a select field

$form['field_equipe_membre']['widget']['#ajax'] = array(
'callback' => 'ajax_desactive_unites_field_callback',
'event' => 'change',
'method' => 'html',
'wrapper' => 'edit-field-unite-de-recherche-wrapper',
);

From the triggering_element field, I succeeded to retrieve a value via a db request and select it in another select field

$trigger = $form ...
Score: 2
Taxonomy term save very slow
ae flag

I have a vocabulary with around 15k+ terms in multi-level hierarchies. Recently I noticed that with this amount of data, when I try to save a term of a higher level (parent to many), it takes a lot of time to save.

I checked with the webprofiler module and saw there was around 10k queries running for such a single term including the queries it is running for it's children. I am not sure if this i ...

Score: 1
Jiah avatar
Programmatically publish unpublished nodes
in flag

I want to publish unpublished nodes in a custom action. To do this, I query the database on a specific condition and want to use 'exists' condition to find the node IDs to publish. This is the code I am using.

$query = \Drupal::entityQuery('node');

foreach($i_selected as $is) {
  $nids = $query->andConditionGroup()
    ->condition('type', 'level3')
    ->condition('title', $file_name)
    - ...
Score: 0
Grand Master B avatar
How can I allow anonymous users to see the file for the exported webform submission data?
us flag

On Drupal 9.2.1, I have a data export set up for webform submission fields in a XML file which is imported by another site.

When I am logged-in, I can view the .xml without issues. Since the permission to view webform submissions is only given to administrator users, the anonymous users see an empty page.

How can I allow anonymous users to see the file for the exported webform submission data?

Score: -1
Dorian Winterfeld avatar
Simple Pie Chart not working in custom module. Do you see any errors in my code?
ae flag

I am running Drupal 9 in Lando. I have enabled the Charts and Highcharts modules and installed the Highcharts JS library with composer. I wrote a simple module to display a Pie Chart but the chart won't display. My code is below. Do you see any glaring errors or ways I can debug this? I ported this from an example that runs fine in D7 in DevDesktop.
The info yaml file.

name: My Test Chart
description:  ...
Score: 0
JonMcL avatar
Why is the region content already rendered as markup?
us flag

I'm attempting to craft some custom layout HTML in one region of my theme (uswds_base, but this doesn't appear to be theme specific). The content of a typical region.html.twig file is like the following.

{% if content %}
  <div{{ attributes.addClass(classes) }}>
    {{ content }}
  </div>
{% endif %}

Why is {{ content }} already rendered as a markup string in a region template? I'd like ...

Score: 3
How to create a custom content entity without canonical url?
ru flag

I've created a custom content entity with drush generate module-content-entity, which works great. However, I want my custom entities NOT to have a canonical url. Drush automatically creates those in the annotation of the entity class:

/**
 * Defines the chunk entity class.
 *
 * @ContentEntityType(
 *   id = "chunk",
 *   ...
 *   links = {
 *     "add-form" = "/admin/content/chunk/add/{chunk_type}",
 *  ...
Score: 0
ice70 avatar
Add created node to parent menu
cn flag

I have a migration that creates nodes from a CSV file. This isn't an export from another Drupal site. It works as expected until I try to add the migrated nodes to a specified menu item.

In the following migration file, publications_create_nodes successfully runs. I can create the menu items for each node with the following.

process:
  menu_name:
    plugin: default_value
    default_value: 'main'
  nid ...
Score: 0
Can the Mailchimp module email node content?
ng flag

I have a blog page. I want to add a sign-up box to collect email addresses so I can email everyone when a new blog entry is added. As I'm on shared hosting, I believe there is less chance of them getting marked as spam if I use a service such as Mailchimp to send the emails.

The Mailchimp module has a signup form. However, as far as I can tell, I can only send email through the Mailchimp 'campaig ...

Score: -2
How to add an external link inside form actions?
ca flag

I want to programmatically add an external link next to my submit button in a form that I have created.

Score: 0
albertski avatar
Locked to version problem when upgrading
cn flag

Every time I run the composer command to upgrade Drupal 8.9.16 to Drupal 9, it notifies me that there is a problem with a module.

For example, I run:

composer require drupal/core --with-all-dependencies

I get:

Using version ^9.2 for drupal/core
./composer.json has been updated
Running composer update drupal/core --with-all-dependencies
Gathering patches from patch file.
Loading composer repositories ...
Score: 0
How to create a view showing Users who have flagged AND are flagged by the current user
nl flag

I'm trying to display a list of users who have flagged the current user, and are flagged by the current user. So a two-way flagging.

I've tried using different relationships and arguments in views, but can't seem to get the combination right. Any tips? Thanks!

Here's my views config from @pkros's instructions as requested.

View Overview

View Relationship

View Contextual Filter

Also, here is a quick screencast showing the issue in action... https:/ ...

Score: 0
ARUN avatar
How do I migrate a nested paragraph field?
fi flag

I have a wrapper paragraph, Layout (para_layout), which has the following fields.

enter image description here

I created the same paragraphs and field structure in a Drupal 9 website. I created the following custom migration plugin.

id: custom_para1
label: Custom paragraph migration
migration_group: custom
migration_tags:
  - node
source:
  plugin: d7_paragraphs_item
  bundle: para_layout
process:
  field_left_column: fie ...
Score: 0
Securing admin account, silly "solution" found
ng flag

Hello fellow Drupalers,

I've been given the task of securing our admin account, on our websites (drupal 7) from outsiders.

My first thought was 2FA and I looked at some of the modules (tfa, google auth, etc) and they seem to be doing the job okay.

But as I was fiddling around I accidentally deleted the admin password.

Now I cannot login through the website with the admin account, but I can via drush ...

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.