Latest Drupal related questions

Score: -3
Prashant Chauhan avatar
How can we use \Drupal class inside Settings.php
cn flag

How can we use \Drupal class inside the Settings.php file so that we can load configurations etc? For example:

\Drupal::config('system.site')->get('slogan');
Score: 0
Meni avatar
Location of product attributes
tr flag

Probably field_data_field_attributes holds attributes data in SQL.

How can I relate this data with a specific product?

Score: 0
How do I print an exposed filter block in a template file?
id flag

I have a view with an exposed taxonomy filter. I configured it to be displayed as a separate block so that I can print it another twig template. I tried this.

/**
 * Implements hook_preprocess_block() for block.html.twig.
 */
 function themename_preprocess_block(array &$variables) {
   $variables['featured'] = views_embed_view('view_name', 'contextual_filter_block_machine_name');
 }

Then I used

Score: 0
Set no cache when generating dynamic local action via derivatives
vn flag

I'm trying to generate a dynamic local action via a derivative. The derivative works and returns a link generated dynamically but the cache seems to maintain its value.

As per this Drupal core change log, I understood I could set cache parameters on the derivative, which I tried but in vain so far - I'm not very familiar with these concepts yet so appreciate any guidance on how to prevent $gid from be ...

Score: -1
Orlando avatar
How to group with charts module - Google library
si flag

I use views to extract data from a webform and I want to graph articles vs quantities (600), I use the charts module with the google library (CDN), but something that should be extremely simple I can't get it to group the articles, there is not much to configure in the charts module. Does anyone know how to do it? enter image description here

Score: 0
How do I test a CKEditor 5 text format field with Behat/Mink?
cn flag

Drupal 10 is switching from CKEditor 4 to 5.

So, I installed the experimental CKEditor 5 module and am attempting to update my Behat tests to use CKEditor 5.

I am using an @javascript test in Behat on CircleCI to check my Drupal 8 site.

The standard I fill in "my field" with "value" step fails for fields that use CKEditor. For example, for a long text field with the label Question, if I add a step:

Score: 1
Rifas Ali avatar
How to update taxonomy field with array of terms?
fr flag

I am having a body like this

{
    "userid": 435,
    "territories_id":[176,139]
}

Where userid is the drupal user id. And I need to update field field_user_territory which is a taxonomy field. I do not want earlier territories to go instead I need to update with 2 more territories.

This is the code I tried.

foreach ($territories_id as $territory_id) {

     
        
            $user = \Drupal\user\E ...
Score: 0
Prashant Chauhan avatar
Is it possible to programmatically change the config_sync_directory path after profile installation?
cn flag

Installing Drupal 9 using a custom profile installation, I have defined "config_sync_directory" in settings.php file in $settings array to pick up the profile config during installation.

  1. During site installation Drupal asks to specify the "config" directory in the settings file
  2. In a custom profile I have some default configurations, I want Drupal to read configurations from that directory during instal ...
Score: 0
How to get PHP code into a Views Filter
us flag

I have a text field which is extracted from photo's EXIF value; its value is similar to 2021-05-31T15:15:05.

I want to create a view, use the filter and get the field added in. However, I can't use PHP code for it. Instead, I have to do it manually everyday: Set field_datetime to 05-30 and change it to 05-31 the day after. Is there a way to do it automatically?

I'm using Drupal 8.8.

Score: 0
user12179366 avatar
Single entity instance fields
cn flag

I have an entity with dynamic fields. Each instance of that entity has its own specific fields. For example, I have a entity named Car. But cars does not have the same attributes. So each car has its own specific attributes. And if I add a new field it will be added among all cars. Is there a way to follow in Drupal 9?

Score: 0
Free Radical avatar
How to store a safevalue of a field in addition to the original?
kz flag

I have a custom field type that I create with a custom module. It is a plain text field where the user type in a string. I want to retain two copies of this field:

  1. The exact string value as typed by the user.
  2. A safe value of the same string.

This is how I create the field:

class MyItem extends FieldItemBase {

  /**
   * {@inheritdoc}
   */
  public static function schema(FieldStorageDefinitionInt ...

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.