Latest Drupal related questions

Score: 0
Add an event listener to select list
cn flag

I've attached the following js to an exposed views form field and it works on first page load but when the form is changed (by ajax) it doesn't fire.

I can't quite work out where to add an event listener for onchange of the select list.

The following doesn't use jQuery but uses the core once library so I would like to avoid jQuery.

/**
 * @file
 * Landing page adjustments.
 */

 (function (Drupal, once)  ...
Score: 0
Souvik Das avatar
Multiple ajax form not working on whole site
rs flag

I have multiple pages which contains multiple ajax forms. When I am working on a particular form, its ajax submission is working. But at that moment, if I go to second page form, ajax submission not working and the page gets reloaded.

But after clearing cache, if I work on second page form, its ajax submission working, but then first page ajax form submission not working.

How will I manage multiple  ...

Score: -3
How to get url path of media file (pdf) in node twig file?
cn flag

I Uploaded a pdf file using media library. Now i want to render file link in twig file. please help in this

Score: 0
Adjust total price in commerce checkout
in flag

I have a store setup with 2 products. Public and private tours. Public tours are 10 for each unit.

Private tours on the other hand are only meant to collect a deposit. I need the total to be $50 no matter the quantity selected and the rest is paid on site.

I tried creating a custom PromotionOffer as seen below. I can create the promotion but it doesn't seem to apply while in the cart/checkout. I eve ...

Score: 0
Matt avatar
Creating an instance of custom entity with entity reference field breaks entity collection page
cn flag

I created two custom entities, entity_one and entity_two. entity_one has a entity reference field that allows you to select unlimited instances of entity_twos. The edit form for entity_one seems to work fine. The field exists and properly auto populates with entity_twos. However as soon as I submit and create an entity_one the list page for entity_ones gives me the error.

Error: Call to a member functio ...

Score: 0
Decoy_Octopus_ avatar
How to group some exposed filters in a collapsible block
cn flag

I have a view with several exposed filters
The theme is based on bootstrap, so I'm looking for a way to group some of them within a collapsible or accordion block (Bootstrap example)

I'd like to avoid installing an extra module if possible.
Drupal version : 8 / 9

Thank you

Score: 0
Ex0r avatar
Custom Views Field Plugin
cn flag

I am creating a custom views field plugin, and I am having a huge amount of notices in the dblog that I cannot trace.

It's a simple views field plugin that just renders some content into a custom "non-db" field on the view.

Issue #1, is that in the view, the field is listed as just ':' (The field group and field name are not being displayed on the view).

Secondly, I am receiving these notices in the db ...

Score: 0
user3099225 avatar
Add SRI hash to existing CDN links
cn flag

I have a Drupal site where there are few CDN links. Iwas thinking of adding SRI hashes to those links.

How can I do that?

Every solution I tried requires to add a custom module, but I don't know how these things work.

Somehow, I managed to create a custom module which creates a Hello page. I just followed a tutorial. Can I add hashes in it?

sri.info.yml

name: SRI Hash
type: module
description: 'SRI  ...
Score: 0
Andrew Magill avatar
Change language code for existing languages
uy flag

My site has two existing languages with several pages of existing content. The language code for both are incorrect. I need to change the language code for English from en-gb to en-ca. Drupal UI doesn't seem to allow that (see below).

Drupal edit language

How can I change the language code for an existing language ?

Score: 0
How to retrieve the geographical coordinates of a photo?
cn flag

I have the Geolacation and Media module.

I publish nodes with photos that contain geographic coordinates in the EXIF.

How to retrieve the geographical coordinates of a photo?

I want to display under each photo of my node, a "Go there" button to go to the exact place where the photo was taken. When the user clicks on the button, the device must offer to open the coordinates in a google maps for example  ...

Score: 0
iain-g avatar
Filter date/time from date-range picker
ar flag

I have a content type with a Date-range field; the default output in the view gives me, for example, Saturday, June 4, 2022 - 16:30 - Saturday, June 4, 2022 - 19:00.

What I would like to show is Saturday, June 4, 2022, 4.30-7.00pm.

I figured out that, in View > Fields I should rewrite results and add a standard Twig filter like {{ field_event_date_time|date('M d, Y') }}, but I get no output from  ...

Score: -1
R Potharaju avatar
Remove actions (edit button) with hook_views_pre_render()
cn flag

I am trying to hide/remove the edit button on a view, for few records using the following code.

function member_management_views_pre_render(ViewExecutable $view) {
  if ($view->id() == 'my_view_id') {
    if (mycondition) {
      foreach($view->field as $key => $value) {
        // $value->_entity->operations->setValue() = 0;
        // operations->field->handlers->displayh ...
Score: 0
Hefi avatar
How do i list all child terms that share the same parent term? But on "child term" page?
et flag

Let's say I have the following taxonomy (a 3-level hierarchy).

  • Acura
    • Integra
      • Hatchback 1991
      • Hatchback 1995
      • Hatchback 2000

If I am on the last term of this hierarchy, for example Hatchback 1991, how do I display all other specific models that belong to its parent (Hatchback 1995 and Hatchback 2000)?

Probably Taxonomy Term Siblings.

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.