Latest Drupal related questions

Score: 3
Schema information for module is missing - how to fix?
in flag

I tried to install the Scheduler module but it did not install properly because we somehow did not have code for another custom module that the database thinks was installed. I got the code for the missing module.

My scheduler module is completely borked, as is my database. I cannot uninstall the module because there is a missing field in the database.

Drupal\Core\Database\DatabaseExceptionWrapp ...

Score: 0
Nicolas E avatar
EntityQuery condition only if field exists
ru flag

How to apply a condition only if a field exists?

$query = \Drupal::entityQuery('node')
  ->condition('type', 'videos')
  ->condition('field_tags', 39, '=')
  ->condition('status', 1)
  ->condition('field_date_start', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT), '<=')
  ->condition('field_date_end', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT) ...
Score: 0
Multisite same host different basepaths
cn flag

I have a site for the virtual host example.com, the base directory for the drupal application is example.com/site1. I'd like to setup a multisite but have the sites only differ by the base path, not the host name. So the new site will be reached through example.com/site2, but it will use the code base in example.com/site1.

I've tried creating a symbolic link https://www.drupal.org/docs/7/multisite-dru ...

Score: 0
Creating file from s3fs (S3 bucket) breaks migration
in flag

I have s3fs module installed and configured, so when I upload some file it goes to S3 bucket. Then I'm making processing plugin which should copy file from another S3 bucket to Drupal's bucket and register that file. Copying bucket to bucket works well, so after that part is done I have file in Drupal's bucket at private/images/image.jpg. Inside private/images folder I also have other images uploa ...

Score: -2
Alter "Action processing results" message for a specific action
in flag

I have a view based on view bulk operations. this is a comment based view and performs the below actions:

1. Publish comment 2. Unpublish comment

When one of these actions are selected to be executed on a set of records, I get to see a success message like below:

Action processing results: Unpublish Comment (1).

I would like to alter the success message as:

The selected comment(s) have been unp ...
Score: 2
Auraylien avatar
Form with two submission buttons
th flag

I try to create a form with two submit buttons and each button will use a different function: the default submitForm function and a custom submitFormEndSession function. So I have this code:

class EndSessionForm extends FormBase {

  /**
   * @var \Drupal
   */
  private $drupal;

  public function __construct() {
    $this->drupal = new Drupal();
  }

  /**
   * {@inheritdoc}
   */
  public function  ...
Score: 2
How do I run the drush tests in docker?
cn flag

I'm trying to improve drush, and the drush contributing guidelines state:

Drush's own tests may be run within provided Docker containers (see docker-compose.yml):

Start containers: docker-compose up -d

So I forked Drush on Github, cloned the repo locally, and then, from the repo root, ran docker-composer up -d. This gives an error:

ERROR: Can't find a suitable configuration file in this director ...

Score: -2
bimsalrobit avatar
InvalidArgumentException: Class ... does not exist in custom configuration form
id flag

I create configuration form, so that I could dynamically set the API key for my custom weather module.

But when I write in the url address http://drupalsite/admin/config/services/weather/settings I get the error:

InvalidArgumentException: Class "\Drupal\weather\Form\WeatherSettingsForm" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core/li ...

Score: 0
julianx2rl avatar
Print a node's image-field path on the template html.twig
cn flag

I need to get this tag into the header so facebook can pick it up when I share links to the website.

<meta id="page-image" property="og:image" content="node-image-field-path" />

I found out that you can print the image's path with this:

{{ file_url(node.field_imagen_portada.entity.uri.value) }}

However, it doesn't work in the html.twig, as if the node's fields haven't been loaded by the time t ...

Score: 2
Eugene Kaganovich avatar
old dates in datetime field
fr flag

I need to be able to enter old dates. I am not allowed to enter anything prior 1880. Using drupal 9, datetime field.

Daterange does not allow to enter anything before 1900.

Any workaround or solution?

Score: 0
Jacob avatar
Split a hierarchal taxonomy into multiple facet filters
cn flag

I'm currently working with an E-Commerce site in Drupal 8 that contains multiple products and multiple specifications set up in a hierarchical taxonomy term called Specifications like this example:

  • Color
    • Black
    • Blue
    • Silver
    • Copper
    • Navy
  • Material
    • Plastic
    • Aluminum
    • Steel

There are many more in practice for this platform, and the product content type contains a taxonomy term repeater field for mult ...

Score: 2
Conditional subelement within custom composite webform element
us flag

I have a webform that has a custom composite element; let's name it composite_name.

Within that custom composite, I have element_a, element_b, and element_c.

Is it possible to make element_c visible only when a value is entered in either element_a or element_b, by editing the composite element in the Webform UI?

I tried putting this in the custom properties for element_c, but it does not work:

sta ...
Score: 0
Dylan Spencer James avatar
Drupal commerce allowing customers to decide the price, for dontations
no flag

There are modules for providing a donation field for Drupal 7. However, there doesn't appear to be a way to do this in Drupal 8/9.

Can anybody suggest a way to allow users/customers to choose the price they want to pay for a product. This may need to be a custom module, but it would be good to get some ideas of how to do this.

Score: 0
Dominika avatar
How do I prevent a block from being loaded via Big Pipe
cn flag

I have a view block, nothing crazy, just a couple fields. I want to present it as a carousel. Everything worked fine, until suddenly Drupal decided to start loading the block asynchronously with Big Pipe. Since I have js library attached to the block, all DOMContentLoaded functions in that js stopped working. How can I prevent it? I need the carousel to work across multiple blocks and I need a reliable  ...

Score: 0
Patrick Star avatar
How can I remove the configuration side panel?
ie flag

I have two drupal websites (running on Drupal 9.2.10). Both of them use modules:

  • Layout builder
  • Layout Builder Asymmetric Translation

Both websites have same configuration (and I don't do any theme overrides using hooks in my modules / themes):

  • Layout builder enabled for content type "Basic page"
  • Checked checkbox (on "Manage form display" tab on each entity) to automatically copy Layout from orig ...
Score: 3
Interlated avatar
How do I use the markdown module to print the module README.md file?
km flag

I've created a README.md file in the custom module and would like to provide this as the help page in formatted HTML.

Raw text is being printed out, how do I get the HTML?

The module is drupal/markdown 3.0.0-rc1.

function cbi_bond_id_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
   case 'help.page.cbi_bond_id':
      $text = file_get_contents(dirname(__FILE__) . "/README. ...

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.