Latest Drupal related questions

Score: -2
how to set Default translated texts in twig file
cn flag

I developed a twig plugin (to display graphs from a webform). These plugins contain English texts; And I want the same file to keep translations for several languages by default (for example, Arabic), that is, the end user does not have to translate these texts through the Drupal interface. Currently using:

{%set Hotness_text ={en:'Cold',ar:'ARABIC_TEXT',fa:'PERSIAN_TEXT'}%}
{% if language == 'en'  ...
Score: 0
rosendo.fig avatar
"Object of class Drupal\Core\Render\Markup could not be converted to number"
in flag

I am receiving an error on a webform I'm developing. Just to give some insight into the webform, the webform is taking in some data (customer type and monthly water consumption) and calculating the cost for Water, Solid Waste, and Sewer. I'm using computed twigs to calculate those cost, and I'm displaying them on the form. (This is where things get complicated). I am displaying current costs and new cos ...

Score: -2
Spectkiller avatar
Drush command is not working
cn flag

I have installed Drush through composer and I have installed Drush 8, but every time I type "drush" in cmd, it shows this output. using win 11 with wamp PHP 8.1

The filename, directory name, or volume label syntax is incorrect.

Score: 0
Raja Chakraborty avatar
How do I skip calling a custom validation function in a form with AJAX dropdowns?
in flag

I am using headless Drupal with .NET middleware. I have a Drupal 9 form. This form contains two drop-down elements which are filled up depending on a value selected in a third drop-down. I have a custom validation handler just after those AJAX drop-down elements, where I store some data in a .NET database.

This is my code for hook_form_alter().

$form['technology_type'] = [
  '#type' => 'select',
  ...
Score: 1
Tobias Krause avatar
Get all entities with more than one reference in a field
cn flag

We have an entity type "mandate" which references to an entity "fraction membership". When a politician changes his fraction during an active mandate a new fraction membership entity is created and referenced in a field of the corresponding mandate entity. What we need is an exposed filter for views "deputies who has changed the fraction membership" which is technically "get all mandates with more than  ...

Score: 0
Monkeybrain avatar
Why am I seeing Modernizr JavaScript errors on page load?
in flag

When I load pages on our live site (D9), we see these Modernizr errors from contextual links JS, and the contextual links don't appear on the site.

Chrome JS Console output

However, Modernizr does appear to be loaded ahead of the contextual links JS, as you can see from the two further screen captures, so I don't see why RegionView and VisualView should think it is undefined.

Modernizr load time Region View load time

and also the Modernizr object is available in the ...

Score: 0
Can't save field translation
cn flag

I have 2 languages on my site (English and Russian). I also have a content type "Home page" and some fields are translantable (configured in admin/config/regional/content-language)

After saving the content in russian translation, changes are saving in english and russian. What i have to do to save these fields for just one language?

Drupal version: 9.3.5

Score: 0
Samuel Fernandez avatar
How do I programatically change a webform's element type?
ng flag

I am using a webform element 'select_other' in the webform. We got a requirement that the Other field should only appear if certain conditions are satisfied. I already have a Webform Handler In place, and using the alterForm(), I tried to change the #type value, which removed the Other option, but duplicates the field wrapper property.

Is there any way to change the #type of a webform element programma ...

Score: 0
Richard avatar
Programmatically update field group description on entity view screen
sa flag

Is there a way to programmatically update the field description for a field group tab on the entity form edit view?

It feels/looks like I should be using something along the lines here

  $form_display = \Drupal::entityTypeManager()
    ->getStorage('entity_form_display')
    ->load('node.page.default');

$item = $form_display->getComponent('third_party_settings');
$item->setComponent('thir ...
Score: 0
Giuseppe avatar
Is possible to find the "original" route while executing code from a widget?
br flag

I'm on D9.

I've a node edit form with a media field using the media library widget.

When a new media is added I'd need to run some custom code to replace one token, of the media path location, depending on the value of the node itself.

However, the route available with \Drupal::routeMatch() is media_library.ui and there is no node object available

I suppose this is correct, as the code is execute durin ...

Score: 0
pglatz avatar
How to specify setting.php file for drush?
in flag

I'm using Drupal 9 and Drush 11. I have two hosts, one for local testing (www.en9-local.pglatz.com) and a remote production server (www.electronovelty.com).

When I run drush status from either of these hosts, I see Site path is set to sites/default. How do I tell drush which settings.php to use? I tried using the uri argument on the command line; it does find the proper site path, but is also giving  ...

Score: 0
Joseph avatar
How to create a module with default settings
cn flag

I have a module I'm working on that links to a sound file and plays it when something happens. I have it so that there is a button in the admin config to set the path of the file to a default path which is a file that comes with the module. Furthermore, one may upload their own file and it will switch to playing that file when the thing happens. The problem is, the module on a fresh install does nothing ...

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.