Latest Drupal related questions

Score: 0
How to show error on screen after failling a webservice call on Webform submitForm?
in flag

I made a custom handler for one of my webform to call a service when the form is submitted. Here is my code. It is working when the service return a response with status code = 200 but I cannot find a way to notify the view when an error is raised by the webservice. I would like to show a modal with an error message but cannot find how to do this.

class CRMWebformHandler extends WebformHandlerBase  ...
Score: 0
liquidcms avatar
How to programmatically grant access to private files?
us flag

I was working under the idea that i could use hook_file_download to grant access to private files; but it seems that this hook can only be used to restrict access to files, not to grant access.

I have seen suggestions of other hooks like file_access and file_access_alter; but none of these exist any more.

Score: 1
Dorian Winterfeld avatar
What is best practice for passing routing parameters?
ae flag

In submitForm() I want to redirect to a controller and pass the form values. The form values are all arrays, btw.

Here is submitForm.

public function submitForm(array &$form, FormStateInterface $form_state) {
    // get values
    $demo_values = $form_state->getValue('demo');
    $data_set_value = $form_state->getValue('data_set');
    $engineering_degrees1 = $form_state->getValue('engin ...
Score: 0
Feeds event subscriber stopped working
cn flag

For some reason my feeds event subscribers have just stopped working.

My code looks like this, the dpm for debugging never gets fired so I think the function isn't being run.

I can't work out what's changed.


namespace Drupal\partshub_feeds_modifications\EventSubscriber;

use Drupal\feeds\Event\EntityEvent;
use Drupal\feeds\Event\FeedsEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface ...
Score: -3
Ella avatar
Webform update!
ng flag

I need to update webform module in my live site, I noticed the warning with doing that with the user Interface so I want to update the files manually, ( because we don't use drush ), Can I get directions for doing this update? again since the site is live and this is our first Drupal site I want to make sure from not breaking the site or having any issues!

also, I have the files in Cpanel so from ...

Score: 0
Display Block to retrieve information from Order Item's Product Variant and display rating & review inside product page
cn flag

I am working on an e-commerce website development. I have the conventional Products -> Product Variants which goes through Order and payment gateway workflow. However, there is something different in this conventional scenario.

I have setup Product -> Product Variation to categorise the different type of fabrics which fall under a same style.

We have different kinds of fabric which we source f ...

Score: -1
Akshar Vijay avatar
How can i change dateformat of webform submission
in flag

Is there a way where we could change the date format of the form submission? For Example in the Webform I have created there's no date picker in it. But when the web form is submitted by the user by default it comes in this format Sun mm/dd/yyyy but I want it dd/mm/yyyy (It is stored in Structure ->Websforms -->Submissions)How can i change the date format once the webform is submitted?

Score: 0
Free Radical avatar
What controls the placement of links relative to the body?
kz flag

I am struggling with getting the "Read more" and "Add new comment" links placed below the body on a custom node content type called "Wikitext" that has been created using the GUI on a Drupal 8.9.17 website.

The site is running the default theme (Bartik) and I have not edited any templates. The built-in content type "Article" shows these links below the body. "Wikitext" is supposed to be identical ...

Score: -5
Why does a query string return a 404 error?
mx flag

I recently upgraded from Drupal 8 to Drupal 9 and noticed a problem that occurs when the URL has a query string. For example for the following URL Drupal throws a 404 page not found.

https://example.com/2021/07/how-drive-cruise-ship&ct=ga&cd=EAEYACoTMzczMDU5MTUxNjcwNDQyMzUxNzIcN2RiZjYwOGY4MzE2NmM3OTpjby51azplbjpHQg&usg=AFQjCNEa2-Hx3zqnQ59AJFnde_ORtLTvgA

Score: 2
Can you rename replacement pattern tokens in views?
ru flag

If you insert one or more custom text field (e.g. to include some Twig logic), latter fields will see such blocks as {{ nothing }}, {{ nothing_1 }} etc. in the replacement patterns.

Can these be renamed? The label and the admin description make no difference.

Score: -1
fin avatar
Why does my shopping cart item not have a label?
th flag
fin

I'm working on D8 site with Drupal Commerce. I have to create a dynamic product variation and add it to cart for the user checkout.

The problem I have, is when you land on the cart page, the line item doesn't have a label (title) it replaced with the price of the item. Please refer to the attached image.

Here's my code:

   //create variation
            $variation = ProductVariation::create([
            ...
Score: 0
Using Twig in global custom text to check for a specific content type
in flag

I am filtering for two content types to display in a view: Artwork Page and Cover Page. I want to change the HTML markup for Cover Page.

I have researched and tried many field names for Content Type, but with none of them I get what I am trying to achieve. In this instance, the replacement pattern for Content Type is {{ type }}; using it doesn't work. I've tried both the machine name (cover_page) an ...

Score: 1
Tapash avatar
How to block the IP that requests excessive 404 page not found?
se flag

On my site often I see thousands of requests thats ends up 404 - page not found error.

How can I block the IP that exceeds more than certain number of requests within a span of time from Drupal?

enter image description here

Score: 2
hotwebmatter avatar
Pathauto alias full path for hierarchical taxonomy terms
nr flag

My client has content tagged by a hierarchical taxonomy of arbitrary depth.

Currently the maximum depth is three, but that could change:

ParentTerm
└── ChildTerm
    └── GrandchildTerm

Each Term has a unique TID (of course), but many Terms (especially descendants) share identical strings for Name.

However, the full Taxonomy tree path to each term is guaranteed to be unique (two adjacen ...

Score: 0
Ruzanna Hovasapyan avatar
How to programmatically add a paragraph item to a user account?
cn flag

I already added the Check in/out History field to the user account, which has the check-in date and check-out date fields.

How can I programmatically add new items to Check in/out History?

I need to create some history for users.

Check-in date Check-out date
04/05/21 05/07/21
03/05/20 04/14/20

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.