Latest Drupal related questions

Score: 1
sonfd avatar
How can I tell, in hook_form_alter(), if a node form is for the node in its default language or a translation?
in flag

I'm implementing hook_form_BASE_FORM_ID_alter() in a custom module. I'd like to know if my form is for the node in its default language, or a translation of that original node.

Score: 0
How to override the output of a views field of type comments
cn flag

My goal is to create a views block that shows the comments of the current node.

I succeeded in creating a views block that includes only the comments field of the node ID from URL.

However, the commenting form is shown below the comments list. I want the form to show above them.

I use the theme olivero, and the normal node display shows the comments form above the comments list.

I see that the node displa ...

Score: 1
Павел Герасюта avatar
Botton webform change bootstrap class
br flag

Maybe someone knows why when you change the name of the button, its class changes from btn-primary to btn-default. btn-primary only if there is a submit in the button name (Without spaces before or after).

Score: 0
Drush fails with PHP 8 due to padraic/humbug_get_contents requirements
cn flag

I'm sure there is a simple fix, but I can't figure it out. This is my error every time I try to run drush updatedb

$ drush updatedb

Box Requirements Checker
========================

> Using PHP 8.0.9
> PHP is using the following php.ini file:
  /etc/php/php.ini

> Checking Box requirements:
  ..E.........

                                                                                
 ...
Score: 2
Yuseferi avatar
Change priority of different aliases with the same aliases
cg flag

There is vocabulary, let's call it forum tags which contain all forum tags, Also, in Forum, the link for the Forum container using a similar tag pattern for the forums. for example,

Term name : windows
term alias: /forum/windows

Forum container: windows
forum alias:     /forum/windows

if I open /forum/windows always term page will be loaded which means it has a higher priority.

at the moment all requ ...

Score: 0
Akshar Vijay avatar
Uninstalling Lightning causes an error
in flag

I am trying to uninstall Lightning. When I run drush pm:uninstall lightning, it throws this error.

In PmCommands.php line 196:

lightning: The Lightning module is required

How can I resolve this?

Score: 1
NBayaman avatar
How do I migrate product fields?
in flag

I'm migrating Drupal 7 commerce products to Drupal 9 and I'm using:

  • Drush (10.5.0)
  • migrate_plus
  • migrate_tools
  • commerce_migrate_commerce
  • commerce_migrate

I have successfully migrated nodes, but I cannot migrate fields. In other words, I have node titles and bodies, but not all the additional fields I have on Drupal 7.

I used the following migration IDs.

  • d7_file
  • d7_user
  • d7_node_complete:general_product ...
Score: 1
maynardsmith avatar
How do I use a hook to modify CiviCRM payment processor details in Webform?
jp flag

I am trying to use hook_form_alter() to change the details of the CiviCRM Payment Processor for specific users (to change from live mode to test mode).

On Drupal 7 it's in $form['submitted'] when Page 2 is rendered. Many items are already there on Page 1, but this is not.

Are these somewhere else, or do I have to use a different mechanism, in Drupal 9?

Score: 0
BlondeSwan avatar
Save multiple entities in one transaction
br flag

We have a custom API endpoint that handles data for multiple users. Unfortunately, we are having a performance issue because every time we save a user entity, the save operation takes 3-4 seconds to complete. Obviously, this is less than ideal, as 10 users will take 30-40 seconds to complete the whole request...

Is there a way to save multiple entities at once (like you can load multiple at once) ...

Score: 1
blur avatar
For which tables should the MariaDB user have CRUD permissions for browsing the site?
bn flag

I'm trying to lock down the database on my Drupal 9 install so that people can browse the website, but can't write to it.

I have 2 users in MariaDB with access to the database. I want to set one account to only be able to write to the needed tables for browsing and give the other account full permissions. To Which tables should the first account have CRUD permissions?

To determine which user to use, ...

Score: 1
Why is single quote sign escaped inside render element attribute?
in flag

When attribute text contains a single quote, like "It's a nice day" that single quote when rendered is escaped to "It's a nice day". Why is that happening and can it be prevented? Is twig doing that escaping?

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Template%21Attribute.php/class/Attribute/8.2.x

it says:

"The attribute keys and values are automatically escaped for o ...

Score: 0
More than one payment option for each plugin
br flag

I'm trying to build a custom gateway module for a payment provider that provides 3 methods of payment. I was following the documentation and building 1 gateway plugin for each method of payment however I found out that the payment provider only communicates notifications to a single URL (IPNs). From my understanding each gateway plugin has its own endpoint that the provider can use to communicate notifi ...

Score: 0
Md. Shafiq Hossain avatar
How to access paragraph fields from a webform's form?
cn flag

I have a webform (contact_info) which is attached to a paragraph's field (field_contact_info). The paragraph has other fields as well.

I implemented hook_form_alter() to change some attributes inside the webform's form.

Is there any way to access the values of other paragraph fields value in hook_form_alter()?

I can pass them inside the webform object, but those aren't available in hook_form_alter()

Score: 0
Custom checkout pane visibility according to destination address
ni flag

Following this documentation, I have create a custom pane checkout for a check field. This check should be visible according to destination address. It works good because isVisible() is fired when you load this checkout page. But the problem is when the user change the destination address or create a new one. I would need to show or hide this check field under this condition, and let the user check it  ...

Score: 1
scaffolding avatar
Add HTML markup to a new paragraph text field
es flag

I'm creating a new paragraph item within a hook_node_presave() function.

The paragraph item is fairly simple, just a title and body text written into a text field with full html text editing. When I attempt to html elements within the body text, I'm unable to get the content to render the HTML tags.

Is there a way to do this using a render array, or another technique?

This is my initial attempt to buil ...

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.