Latest Drupal related questions

Score: 1
The form argument Drupal\terminal\Form\TerminalCliForm is not a valid form
cl flag

I've read through other questions regarding the same error message. They all seem to end up being due to typos or the file path. I don't believe that is the case here, but we'll see. I have a working instance of the same code aside from the names, which is all the more confusing.

I enable the module below. Select place its block. And then when I hit the page, receive:

InvalidArgumentException: The for ...
Score: -2
blur avatar
Libraries, CSS, and conditional loading
bn flag

In looking at the attached screen shot from mytheme.libraries.yml, I see 'base:', 'component', 'layout', 'theme', and so on.

Do these designations represent/do anything in practice? Or is this just for organization of the libraries.yml file, or does this imply where/when these CSS files load? For example, form.css only loads when a form is present.

I can see this happening in modules, but in the the ...

Score: 1
Mauricio avatar
How to know if a batch process is still running?
lb flag

I have a form with 5 buttons and each button run a different batch, some batch processes take several minutes. I want to block the button if the batch processes is already running, because other user admin can access to the same form and try to run the batch that is already running at this moment for other user.

How can i know what batch processes is running? i try using batch_get(); but every ti ...

Score: 0
cURL request causing form validation error
in flag

I'm working on a cURL request when a user submits an existing form to send some data to an outside service.

I've added this function with this line: $form['actions'][$action]['#submit'][] = 'my_module_push_data';

And my cURL requests:

    $ch = curl_init();
    // Get access token here
    curl_setopt($ch, CURLOPT_URL, 'https://resturl.com&id=' . $id . '&secret=' . $secret);
    curl_setopt($c ...
Score: 0
How can I have a custom block show different content on the front page?
za flag

I have a custom module, in Drupal 9, (showing a block in a region) that has an admin form with a checkbox for showing only on the "front page" or if unchecked on "all" pages.

In order for the block to show on the homepage or on all pages do I need some sort of preprocess function to run before the block loads? Does the build() only happen once and then is cached? If so, how do we let the block kn ...

Score: 1
Custom display in saved Entity reference in Widget field
us flag

We have an entity reference field widget. Based on a view where you can enter the code of a product to get to the product reference.

The widget shows the 2 fields (code) - (Title) when we type in the widget.

But after saving, only the title and the Node ID is shown. Title (nodeID)

How can I override what is displayed in the entity reference field to include my product CODE in prefix? (code) - (Title) ( ...

Score: 2
Using the entity query API to identify entities with correlated values
ai flag

Imagine two Drupal 9 custom entity types named a and b.

Entity type a has two fields a_f1 and a_f2.

Entity type b has a field b_a which is an entity reference with a target type of a and unlimited cardinality.

How does one create an entity query which finds all entities of type b at least one of whose b_a entity references points to an a entity which has value 'v1' for its field a_f1 and value 'v ...

Score: 2
VEERAPRASAD avatar
S3FS IMCE File upload issue for old files in Upgraded site
cn flag

I have a question on IMCE File upload. Hope someone might have come across the similar issue.

Installed modules:

We have added a file/image field and chosen following option from Manage form display [admin/structure/types/manage/mycontent-type/form-display] to have Open File Browser option above the specific field.

Allow users ...

Score: 0
megsani avatar
Frontpage slideshow not showing
us flag

Here are the steps that I have taken:

  1. Created a content type of "slide" with the following fields Title Body Link Image
  2. Created 3 slides with "slide" content type.
  3. Created a new view named "slideshow" using Views Slideshow (slideshow). The preview correctly displayed the slideshow.
  4. Added the block "slideshow" in the theme's block "Featured"
  5. Configured the block to show only slide content.
  6. Saved  ...
Score: 1
Interlated avatar
How do I add items from from the user module to a menu?
km flag

How do I add the core user module links such as My account and Log out to another menu?

Score: 0
quantumized avatar
How to add custom option value to select field in Webform and have them save with the submission?
ng flag

I have a Drupal 7 webform when I need to dynamically populate a select field's options. I'm currently using hook_form_alter() and setting the values on the like so:

<?php
 $form['submitted']['left']['select_field_name']['#options'] = $new_options;
</php>

This works for displaying the new options on the webform creation but the values are not saved with the form.

I know there is a hook_webform_se ...

Score: 3
Kevin avatar
Prevent rendering of Layout Builder regions that have no content
in flag

Using Layout Builder, when you add a block to a layout that has access controls and a user visits a page without access, the layout is empty.

How does one prevent the layout from rendering at all if its contents are empty? While the {% if content.foo|render|striptags|trim %} trick works for block templates, I can't figure out how to get the same effect with layout templates.

The end result is I h ...

Score: 0
Rog Boy avatar
Adding conditional comparison of two columns in relationship
ma flag

I am trying to put value comparision while creating relationship. When i give direct value that works perfectly fine. but i wanted to pass column name with alias to get required results.

This is working fine

$this->query->add_where(
        $this->options['group'],
        db_and()
          ->condition("class.end_time", 1625047346 , '<=')
    );

output
WHERE ((( (class.end_time <= ...

Score: 1
Codium avatar
Why custom condition is not containing parent entity?
us flag

I'm using:

  • Drupal 9.1.7
  • Commerce 2.24

I'm trying to create my custom condition (based on https://docs.drupalcommerce.org/commerce2/developer-guide/core/conditions). However parent entity is always NULL. Seems like parent entity is only working when I specify commerce_order as entity_type only, but I need commerce_order_item. ParentEntityAwareInterface and ParentEntityAwareTrait are in use. Debugging s ...

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.