Latest Drupal related questions

Score: 0
Don Pickerel avatar
Give webform text field computed value
de flag

I have a webform in Drupal 8 that is submitted with the count of each answer from another webform survey form filled out earlier.

So form A is filled out through the month, then form B is submitted at the end of the month with the number of each answer from form A.

I'm trying to figure out the best way to add the default value to the report form B.

  1. hook_form_alter,
  2. .theme function and computed twi ...
Score: 2
Search API fulltext search that includes entity reference fields in the 'search index' display mode: Is this the correct configuration?
pe flag

To get entity reference field values (not IDs) to work in full text search, is it necessary to add each entity reference field's "name" to the index as a separate field of the fulltext type?

Background: Using DB backend with multiple content types, each having several entity reference fields for taxonomy terms in different vocabularies.

I included all of these entity reference fields in the "search index" ...

Score: 1
How can I implement sign in with Google / Apple for a decoupled site?
cn flag

I have a decoupled Drupal site that uses JSON:API to serve an Ionic React app.

I'm currently using the JWT (JSON Web Token Authentication module to enable users to register and log in (alongside the Get JWT on Login module) to the app/Drupal site.

I have used the Email Registration module so that users only need to provide an email address and password to log in, so the sign-up form is very simple ...

Score: 1
Giuseppe avatar
How target specific version of fork based merge request (MR) patch
br flag

I'm upgrading the core from 9.1.7 to 9.2.5, however there's a patch I don't how to upgrade.

This is the relative issue. The file 2897638-48.patch is currently used. The patch's work meanwhile proceed and was integrated in the "fork based merge request (MR)" system.

I opened a issue in the past on the general use of the MR system, read this one and the documentation of Drupal site, so at least I know ho ...

Score: -1
PHPUNIT is running successfully on local but giving error on acquia-pipleine
ye flag

When I am running the .vendor/bin/phpunit it is not giving any error. o/p:

Testing . 1 / 1 (100%)

Time: 00:00.014, Memory: 14.00 MB

OK (1 test, 1 assertion)

When I am running the same on acquia-pipeline's build it is giving the below error.

Executing step test.

  • ./vendor/bin/phpunit docroot/modules/custom

PHPUnit 9.5.9 by Sebastian Bergm ...

Score: 0
Vivank Sharma avatar
How to fetch results displayed on Automated testing page of a contributed module?
lb flag

I am trying to get the information presented on, for example, https://www.drupal.org/node/343333/qa for the Chaos Tool Suite (ctools) module through the Drupal's REST API.

I have tried following How to get Automation testing results of Drupal contributed module through Drupal.org rest API? but I am unable to fetch the information for the overview of all tests of all version using it.

Score: 0
fin avatar
How do I make JavaScript behavior run on every page load?
th flag
fin

I don't know how to run my Drupal.behaviours.mybehaviour on every page load.

Here's my code example that run only once, when I load the page is no longer run my code, how can I change that from once to run on every page load:

       Drupal.behaviors.searchFilter = {
            attach: function (context) {
               once('searchFilter', 'html', context).forEach( function () {
                   c ...
Score: -1
John avatar
Show two content types in same view
rs flag

Drupal 8 newb here,

I have two basic types I need to show in my front page: There’s a “Restaurants” content type and a “Chefs” content type.

These are shown in my site like this:

Site layout

The types are unrelated, I just need to show them in the same page as featured.

I’ve found documentation on how to make blocks and views but nothing about mixed content, which seems to me like a common use case.

Score: 0
Jed_BH avatar
Wkhtmltopdf fixed header/footer options print extra blank pages. How to debug and fix?
us flag

So for this I am using entity print 2.2.0 with WKHTML 0.12.6 wit these patches:

            "drupal/entity_print": {
            "Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch",
            "Adding page numbers in footer in pdf": "https://www.drupal.org/files/issues/2020-05-29/entity_print-custom_footer-2823430-7.patch"
        }

The second one allows fo ...

Score: 1
Aves2432 avatar
How do I programmatically create an order without deleting a profile?
eg flag

I followed Orders to write the following code.

$order = \Drupal\commerce_order\Entity\Order::create([
  'type' => 'custom_order_type',
  'state' => 'draft',
  'mail' => '[email protected]',
  'uid' => 1,
  'ip_address' => '127.0.0.1',
  'order_number' => '6',
  'billing_profile' => $profile,
  'store_id' => $store->id(),
  'order_items' => [$order_item],
  'placed' => ...
Score: 0
cocq avatar
How can I programmatically delete a field value?
gb flag

Using Entity API, I know how to get a value or to set a value :

$nid = $entity->id();
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);
...
$nom = strtoupper($node->get('field_nom')->value);
$node->set('field_nom', $nom);
$node->save();

But is there a possibility to delete a value of this field?

I tried to directly delete the value in the database

$query =\Dr ...
Score: 1
JemoeE avatar
How do I programmatically create a path alias?
vn flag

How do I programmatically create a path alias in Drupal 9?

I'm creating node, but I also want to give the node a URL alias, but cannot figure out what class to use, PathAlias or AliasManager or ...?

Score: 0
Gokulakrishnan Shankar avatar
Is a block the same thing as content?
ng flag

I'm new to Drupal and I would like to know how to manage content in a block. This is what I understood so far:

  • The Drupal page is divided into regions and each region consists of one or more blocks which can be configured in the Appearance/Block Layout page.
  • According to my understanding, there are 2 ways to add content:
    1. Directly go to the Content tab and manage the content. However, I do not know into ...
Score: 0
How do I alter a view and add/change the form action in Entity View Attachment (eva) with table format?
cn flag

I have 2 related content types (Order and Proposals). In the Order Detail page, I attach the proposals for that order using EVA with table format.

screenshot

I want to add an action button (vote) in EVA output (orange colored box buttons), so that when it's clicked, it updates the Vote field in the corresponding proposal node. I don't know where to start.

I've tried using hook_view_pre_render() but I can't fin ...

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.