Latest Drupal related questions

Score: 4
baikho avatar
drush config-status on translation / language config files?
us flag

Similar with but not the same as How to use drush config:set for translations?, is there a way to scan for a site's language config changes via drush or so?

I have a lot of sites on the same server (multi-site), and I would rather check on this via a drush command than having to log in each of the sites to look at the output of /admin/config/development/configuration.

For normal config changes I could  ...

Score: 0
Webform one-time submission token+URL
qa flag

I have two webforms:

  1. Email webform: asks for the user's email address.
  2. Voting webform: contains an entity selection list from which the user can select one and submit their vote.

In the email webform, there is a confirmation email sent to the submitted email address. In this confirmation email, I want to have an URL that points to the voting webform, and I want this to be a one-time-URL, as I want ...

Score: 0
spacecraft96 avatar
How to filter entity_autocomplete results by content type and a field
ng flag

I am trying to implement an entity autocomplete field in a form where the autocomplete entities are filtered by content type and a certain field of that content type.

I know I can filter the autocomplete by using target_bundles in the #selection_settings

'#selection_handler' => 'default',
'#selection_settings' => [
  'target_bundles' => ['my_content_type'],
]

But I'm still lost on how to f ...

Score: -2
Jiah avatar
Form submission field not available in form action
in flag

I have the following form submission handler.

function mymod_form_submit(&$form, FormStateInterface $form_state) {
  $ka_selected = $form_state->getValue('ka_types');
  \Drupal::state()->set('ka_types', $ka_selected);
  return $ka_selected;
}

It returns the ka_types field value. I want to use $ka_selected in custom action code.

public function execute(ContentEntityInterface $entity = NULL ...
Score: -1
Jiah avatar
Set "select" field on a node programatically
in flag

I am creating nodes programmatically on a specific content type. The content type has a "select field" that I am trying to set value with and cannot do it. Below is my code:

 $node = \Drupal::entityTypeManager()->getStorage('node')->create(array(
      'type'  => 'level3',
      'title' => $file_name,
      field_level2_title => [
        'value' => 'Assessment'
      ],
      fie ...
Score: 4
sonfd avatar
How can I add a boost to a search_api_solr query if a field has a value?
in flag

I'm trying to add a boost to a search api Solr query when a field has a particular value, e.g. when its nid = 123. Looking at Solr version 8.7 docs for boosting (my solr server version), this looks pretty straightforward. I just need to add a bq parameter like:

bq=nid:123^10

When I go to my Solr server's admin UI and add a query there - first checking the edismax parser checkbox, and then adding

Score: 0
Jiah avatar
Read comment attachment name and file location
in flag

I have a view that has comment, comment attachment(as a file). I want to read the file name and it's location. View looks like below:

enter image description here

I am able to read the title by the below code:

 public function execute(ContentEntityInterface $entity = NULL) {
    // publish the selected comment
    $entity->setPublished(TRUE)->save();

    //Read all the fields from entity
    $comment = $entity->get('c ...
Score: 0
The Hub Web avatar
Reformat Date Argument in Contextual Filter
in flag

I have an argument in a view, contextual filter - {{ arguments.field_news_date_value }}. How can I reformat a date value from YYYY-MM-DD to DD Month Year in the view

Score: 1
Ivan Ginovski avatar
How to make view display plugin translatable?
jp flag

I have a custom view display plugin which extends from the block plugin. When I add a display on the view, the fields or anything in the display is not translatable (see image below) enter image description here

How can I make the fields in the view display plugin translatable?

Score: 0
SANGEETH KUMAR S G avatar
CKEditor inline image upload not working
cn flag

I updated my 3 years old drupal site from Drupal 8.5.0 to 8.9.16 recently. Since the update, there are some issues which I am trying to solve.

In one of my article content type, I have a ckeditor to input article body. After the upgrade, I am facing some issue in adding inline images to the CKEditor. When I click on the inline image add button, it shows 'Loading...' and it goes for ever. Error screenshot

When I c ...

Score: 0
Jiah avatar
Pass the view rows into a custom VBO action
in flag

I have a view with set of results. I want to pass the view rows into custom VBO action. I saw the below links that already implements this "pass_view" functionality in VBO.

https://www.drupal.org/project/views_bulk_operations/issues/1180538 --> Drupal 7

https://www.drupal.org/node/2884847 --> Drupal 8

This feature is not implemented in the recent VBO version. I am using Drupal 9.

Any help on h ...

Score: 0
quantumized avatar
Is it possible to generate a link to a private file that can be shared with an anonymous user to download the file?
ng flag

In Drupal 8 we need to generate a link to a private file that can be shared with an anonymous user to access.

In our function we have the file object for the private file and are currently generating the link to the file like this:

   $build['#link'] = Link::fromTextAndUrl(t('Download original file: ' . $file_name), Url::fromUri($url, $options))->toRenderable();

However, the link generated is only acc ...

Score: 0
rukya avatar
Quantity on cart can be only set to 1
id flag

I can add to the cart as many items as like, for example 4. When I visit the cart page, I can see 4 items in the cart.
However, I cannot proceed to the checkout as I see a message which says the value should not be greater than 1. When I inspect the quantity form element, I can see the minimum and the maximum are set to 1.

I also cannot remove items from cart unless I change the quantity to 1.

Where can I ...

Score: 1
emma avatar
Create several fields from one array field
ro flag

I have a Drupal View based on one entity that is pulled from another database (it is a CiviCRM entity pulled into Drupal with the help of CiviCRM Entity Drupal module).

One of the fields I use is an array field (let's say it's called arrayfield), which outputs an array like item1, item2, item3 (items are strings) for each instance of the entity. The number of items (that is, the array length of arrayf ...

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.