Latest Drupal related questions

Score: 0
sea26.2 avatar
Create address element for webform to output country code
om flag

I'd like to create a field using webform that accepts a country but outputs the country code.

I'm guessing one path forward is to find the handler used by contrib and extend it? Or is that functionality already in the plugin and hiding in plain sight?

Score: 0
Matoeil avatar
Using webform module without storing the submissions
za flag

On the youtube tutorial Emailing & handling submissions from jrockowitz, the main maintainer of the webform module, he said at 7:13 that webform can be used without storing the submissions. For GPDR concerns, I would need to use the form only to send an email with the datas to an external service

How can I set that ?

Score: 0
Toki avatar
How to let a boolean field on NULL if untouched?
id flag

Steps to reproduce my issue :

1- Add a boolean field to Article content type, not required, without touching default value

2- Edit an Article content without touching the boolean field.

3- Save the content.

4- The boolean field displays now FALSE value.

How to let this boolean field untouched and without any value (and thus hidden on full content display)?

Score: -2
user888 avatar
Missing or invalid themes
ph flag

I created 2 custom themes a while ago and I deleted them since I don't need them anymore.

Although I deleted all the files, I am still getting this error.

Missing or invalid themes
The following themes are marked as installed in the core.extension configuration, but they are missing.

Is there a way to avoid this error message?

Score: 0
Alexdezark avatar
How to nest fieldsets?
br flag

My goal is rather simple, I need to group several fieldsets in a fieldset like in the image below :

enter image description here

I tried with the following code :

    public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
        
        foreach ($this -> order -> getItems() as $key => $order_item) {
            
            dpm($order_item -> getPurchasedEntity() ...
Score: 0
infiniteloop avatar
Filtering the result set of entity_autocomplete
ml flag

The following snippet of code is found in the 'nodeaccess' module. At the moment, the autocomplete is allowing you to search for any user in the db. What I would like to do is only return users that have role A or role B.

if ($user->hasPermission('access user profiles')) {
  $form['keys'] = [
    '#type' => 'entity_autocomplete',
    '#default_value' => isset($form_values['keys']) ? $form_ ...
Score: 0
Hometoy avatar
Webform block shows for anonymous user but not authenticated
in flag

I am using the webforms module (6.1.1) on a Drupal 8 site for a form that shows up in a block on my front page.

If I am not logged in (go Incognito or InPrivate mode) the form displays and works.

If I am logged in, the form does not show, but the < div> it is located in does.

It works in the admin pages as expected.

I have verified that the Webform's Access has Roles "Anonymous user", "Authentica ...

Score: 0
Jay Barone avatar
Filter View of webform submissions by user
do flag

I'm using Drupal 9 and attempting to produce a list of submissions (event registrations) filtered by each user so the user can see a list of events they registered for. All other solutions I've found involve modules which do not work in D9. Each registration should be present once and be listed by the Event Name field, but I can't seem to only display the webform submissions belonging to the currently  ...

Score: 0
Beat Giezendanner avatar
Strange behaviour of regions displays in D9 Bootstrap theme
jp flag

I'm working on a site based on Drupal 9 and Bootstrap 5. I can normally create new regions and call them in the front.html.twig template, so that they are correctly displayed and rendered in the block-layouts-list.

When I try to override a region with its own template, renaming it region--NAME.html.twig and calling it with {{ page.NAME }} in the html.twig template, its content doesn't show up.

Aft ...

Score: 1
Search API + Facets: Overwrite facet output and conditionally alter query condition based on active filter
kr flag

I have a date field on hundreds of nodes indexed. I created a facet for the date field but it displays all dates available (ew). Instead, we'd like a filter for "Available Now" nodes and "Available in Future" nodes.

Facet Solution: create a custom processor to replace the facet results (hundreds of timestamps) with "Available Now" and "Available in the Future".

/**
 * Provides a processor for Availabi ...
Score: 0
ewik avatar
How do I add the news that I created earlier to the slideshow using the Paragraphs module?
fi flag

I created Content type - News. And added ten news. Using the View module, I displayed them on the /news page.

I need to make a slideshow with 3 selected news on the frontpage of the site using the Paragraphs module.

First, I looked and read many manuals on how to create a slideshow in Drupal.

And all manuals have similar steps for implementing a slideshow. Using the Slick Carousel module as an example: ...

Score: 0
Replace E-Mails in Webform 8 when dumping to test stage
ng flag

We sanititze our dumps from production to test so that no newsletter subscriptions, form submissions or ohter things get into the test environement and bad things happen :D

Is there a simple way to get the E-Mails configured in webforms automatically replaced too?
As the number of forms and drupal sites will grow (100+), its a bit hard to handle with drush or sql.

Score: 1
Lambic avatar
Entity reference auto complete field is missing value on ajax callback
ph flag

I have an entity reference field on my content type using the autocomplete widget.

I'm adding an ajax callback to that field using this in a form alter:

$form['field_er']['widget'][0]['target_id']['#ajax'] = [
  'callback' => '::ajaxCallback',
  'event' => 'autocompleteselect',
  'wrapper' => 'nm-resend-selector',
  'progress' => [
    'type' => 'throbber',
    'message' => t('Updati ...
Score: 0
Altering menu machine-name
pt flag

A website I'm inherited somehow has a menu which has an underscore in it's machine name. In my attempt to alter that machine name, I found this post and created the following update function:

function mymodule_update_8019()
{
  Drupal::messenger()->addMessage('updating ...');
  $database = Drupal::database();

  $database->update('menu_tree')
    ->fields([
      'menu_name' => 'hierarchy ...
Score: 1
meen avatar
Get raw SQL query from Drupal::entityTypeManager
cn flag

How can I fetch the raw sql version of the following statement?

             $t = \Drupal::entityTypeManager()
              ->getStorage('taxonomy_term')
              ->loadByProperties(['name' => $s, 'vid' => $v]);

Couldn't find anything suitable to try with EntityTypeManager. TIA.

Score: 0
pepe199111 avatar
Recaptcha v2 module doesn't protect a custom forms
in flag

Recaptcha v2 as a standard has forms for protection: Comment, Contact Form, User Login (recommended for security), User Login Block (recommended for security), User Register (recommended for security). Customs forms aren't included and they have a protection under the captcha module. I added a custom form that has protection under the Captcha module, I found my custom form id and added it into the captc ...

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.