Latest Drupal related questions

Score: 1
JSON:API FieldEnhancers - removing a resource object from a JSON:API response
de flag

I need to remove a resource object (in this case a paragraph) from a JSON:API response when it matches a specific condition. I do not want to delete it, I just want to exclude the object from the response.

Approach: I tried using a FieldEnhancer to access the resource object in "doUndoTransform()", check for the condition and skip/remove it before being displayed.

Problem: So far I only succeeded in alter ...

Score: 2
How can I provide language-aware URL patterns for Pathauto?
fr flag

I am using this pattern in Drupal 9 Pathauto to generate URLs:

[node:menu-link:parents:join-path]/[node:menu-link]

This does however not seem to work when using translated content. The generated URL keeps generating in the default language. How can this be solved?

Thanks.

Score: 1
jacksparrow avatar
Batch API drush command running once then shows Solr error
ve flag

I am trying to create a drush command to run a batch process. When I run the command, the batch runs just once, and I get this error :

in Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase->handleHttpException() (line 1026 of /var/www/html/web/modules/contrib/search_api_solr/src/SolrConnector/SolrConnectorPluginBase.php). Drupal\search_api_solr\SearchApiSolrException: Solr endpoint http://s ...

Score: 0
drupalSettings values lost when accessed from a named function
cl flag

I have a custom module and in it's .module file I add a value to Drupal settings:

  $variables['#attached']['drupalSettings']['my module']['color_body'] = '#dd0000';

I have a named js function and try to access the value:

function loadcal() {
  var backgroundColor = drupalSettings.mymodule.color_body;
}

I receive the error:

Uncaught TypeError: Cannot read properties of undefined (reading 'my mo ...
Score: 0
erutan avatar
Any idea why exposed sort filters won't show up when configured correctly in D9.3 (works on simpletest.me instance)?
cn flag

D9.3.12

I have a block view with sort criteria configured, but no exposed sort criteria show up in the preview or on the site when placed - "Exposed form in block: No" and "Use Ajax: Yes". If I duplicate it to be a page or embed (exact same settings) the sort criteria show up this persisted across multiple views.

I uninstalled BEF in case that was interfering with things, but there was no change.

Score: 1
Burly Uranus avatar
How to add an unique wrapper id to a widget element?
lb flag

I made a widget that "generates" fields based on the option chosen of a select field. I got most of the logic done:

1- An option is chosen from this field:

 $element['value'] = [
  '#type' => 'select',
  '#options' => $this->getBreakpointsGroups(),
  '#default_value' => $value,
  '#ajax' => [
    'callback' => [$this,'updateBreakpoint'], // don't forget :: when calling a class method ...
Score: 1
How can I use a different dialog for flag removal than for setting the flag?
pe flag

My project has a special flag with an entity reference field in it to nodes of a content type I'll call here "bucket."

How it works:

  • The flag "add to bucket" appears on nodes of type Article
  • If the user wants to bucket the node, they click the 'add to bucket' flag
  • The 'add to bucket' flag is configured to display a dialog (at the moment, not modal)
  • The dialog allows them to select a bucket; on su ...
Score: 1
thiokol avatar
CartEvents::CART_ENTITY_ADD vs OrderEvents::ORDER_ITEM_CREATE
cn flag

What is the actual difference between these two events?

Is it simply that OrderEvents::ORDER_ITEM_CREATE is triggered for order items added in any way (like both from front end cart and from back end admin UI), and CartEvents::CART_ENTITY_ADD is only triggered when an item is added to a cart?

I understand that order items could be things that are not purchasable entities etc so there is a difference ...

Score: -1
Anton avatar
How can I override a displayed node with the content rendered by a custom module?
de flag

I have a path /application, which is rendered by a custom module (through a combination of theme hook/controller/routing/twig). It's basically a mini-application.

I also have a Drupal node /data, which is a Drupal node with content loaded by Drupal.

However, I need to load the contents of /application at /data. I tried setting the routing of my custom module to use /data instead of /application, but ...

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.