Latest Drupal related questions

Score: 0
Fixing different configs
ng flag

After I have run drush cim successfully, I can run drush cst and I see a great number of entries where the configs are "different". What is the best method to fix this?

Score: 0
Webform_Autocomplete will not accept variant override for existing webform option
mg flag

Recently I've been trying to create a webform with quite a lot of variants for fixed amount of recurring users. The problem I am facing is whenever I try to override a webform_autocomplete component's autocomplete_items value within the variant with an existing webform option, I do not get the desired result. Instead I get whatever the autocomplete_items is selected in the main form. I can override pret ...

Score: 1
RaMeSh avatar
How can I inject dependencies based on conditions?
cn flag

I am creating one custom form and in this form I need to use one service which are there in another module. I need to use that dependency injection based on condition which are there in configuration.

Conditions in Config Form:

  1. Use Custom1 Form
  2. Use Custom2 Form

If “Use Custom1 Form” enabled, then I need to use dependency injection.

namespace Drupal\test\Form;

use Drupal\Core\Form\ConfigFormBa ...
Score: 0
Giuseppe avatar
How use DependencySerializationTrait?
br flag

I'm on Drupal 9. I'm trying to edit the ProductVariationAccessControlHandler class of Commerce.

The class extends Drupal\Core\Entity\EntityAccessControlHandler which in turn extends the abstract class EntityHandlerBase

This abstract class use the DependencySerializationTrait trait.

Now, I want to inject a new service inside ProductVariationAccessControlHandler. The parent class has a __construct method:

Score: 0
Change product price title in form
cn flag

How can I access the label of the product price field to change it for example to "amount" instead of "price"?

The html for the field is:

<div class="js-form-item form-item js-form-type-commerce-number form-item-variations-entity-price-0-number js-form-item-variations-entity-price-0-number">

<label for="edit-variations-entity-price-0-number" class="js-form-required form-required">Price&lt ...
Score: 0
Cannot add new user due to "Integrity constraint violation: Duplicate entry" error
in flag

Starting December 14, 2021, my site began creating users with low user IDs, even though the highest-used user ID was 9317. I thought something had been changed in a core update to reuse IDs that had been freed up by canceling a user account. However, I discovered that since that date, the site has been trying to reuse every ID starting with 1. My error log is filled with errors like this:

Drupal\Cor ...
Score: 2
Cannot resave nodes with entity->save(), no particular error
cn flag

I'm trying to write a drush command to resave all the nodes on my site.

I searched for a module and found the Resave All Nodes module, but its drush command isn't ready yet. So I decided to try to write it myself.

However, I can't get my nodes to re-save with $entity->save(), and I don't understand why.

<?php

namespace Drupal\resave_all_nodes\Commands;

use Drupal\Core\Entity\EntityTypeMan ...
Score: 0
Set minimum commerce product price
cn flag

I want to set a minimum price that can be entered in the product add/edit form of Commerce. If users enter a lower price, an error should be displayed, when they click on the save button.

I am using the following code to achieve that.

function THEME_form_commerce_product_default_add_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['#validate'][] = '_custom_fo ...
Score: 1
Add Relationship to Entity in a Content Datasource View?
ve flag

Good afternoon,

I have configured a (Search API) search index using an entity content type, but I don't need to index all the fields. Is there a way to add a relationship to the referenced entities in the view? All I see are items with the 'Content datasource' category.

Perhaps I am missing something when building the search index?

Thank you!

Score: 0
Linkit Module - Pointing the link's title attribute to a custom field. Hook available?
us flag

Currently the Linkit module delivers the link's title attribute by pulling the related node's title field.

We would like it to point to another field in the node.

How can we achieve this?

I looked into Editor Advanced Link module, but I need this to be automatic, and my custom field changes based on content type.

Maybe someone has a hook idea?

Score: 0
Kevin avatar
Allow module configuration per language
in flag

I have a module that lets site editors enter plain text title and description for a sitewide element. This site supports several languages - how can I enable entering values for each enabled language?

I see documentation here:

https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata#intro

Do I simply update my schema for a langcode and add a language selector on the configu ...

Score: 0
Kevin avatar
"Mismatched entity and/or field definitions" after enabling contributed module
in flag

I installed the Rabbit Hole module in Drupal 9. I was immediately greeted with this message on the status page:

Mismatched entity and/or field definitions

The following changes were detected in the entity type and field definitions.
User
The Rabbit Hole action field needs to be installed.
The Rabbit Hole redirect path. field needs to be installed.
The Rabbit Hole redirect response code field needs ...
Score: 1
thiokol avatar
Commerce order delete and order item delete events
cn flag

Quick question I hope someone can easily answer.

There are two order events for order delete listed here: https://github.com/drupalcommerce/commerce/blob/8.x-2.x/modules/order/src/Event/OrderEvents.php

commerce_order.commerce_order.delete

and

commerce_order.commerce_order_item.delete

I want to delete some related entities when an order line is deleted, so i can hook into commerce_order.commerce_order ...

Score: 0
Mat avatar
Module Broken Link – installation fails
za flag
Mat

The ›Broken Link‹ module yields an ›unexpected error‹ during installation. Afterwards everything seems to be fine and the module is listed as installed, but a node Administration->Configuration->System->Broken Link is missing.

What am I missing?

The error seems to be:

Type    php
Date    Thursday, February 17, 2022 - 10:39
User    me
Location    https://mydomain.at/admin/modules
Referrer  ...

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.