Latest Drupal related questions

Score: 0
Frédéric Hébert avatar
specific submit handler to user form
us flag

I have a submit handler to the user form. It redirect the user to a specific page.

use Symfony\Component\HttpFoundation\RedirectResponse as RedirectResponse;

/**
 * @file
 * Primary module hooks for EHESS Propositions 3 module.
 *
 * @DCG
 * This file is no longer required in Drupal 8.
 * @see https://www.drupal.org/node/2217931
 */
function ehess_propositions_3_form_alter(&$form, &$form_s ...
Score: 1
Interlated avatar
How to filter autocomplete on a dependent field?
km flag

Goal - How to filter autocomplete based on a related field? In this domain, an organisation is selected and then the autocomplete should only allow items created by that organisation to be selected.

The setup involves an

  • inline entity form to select the organisation. This is the triggering field.
  • auto complete field to select a related bond by that organisation

The triggering element is called 'issue ...

Score: 0
Alfonso_MA avatar
Geofield -> Filter points inside a polygon
cl flag

I have two content types. Each of them has a Geofield field:

A -> It has a Geofield of type polygon

B -> It has a Geofield of type point

I would like to build a view to show all B nodes that are inside a polygon defined from a A node, on a map.

I did not find any way to get that with Drupal 8 (I tried different geo modules such as Leaflet and Views GeoJSON). Is it possible with any module comb ...

Score: 0
mathieu avatar
How to limit the addition of a single node in a Group?
mw flag

On my Drupal 9 site and Group module. I created a type of group "Blog". I want that in a group, only one node of type "Article" can be added.

How to limit the addition of a single node in a Group?

So a maximum "Article" type node per group.

Score: 0
mathieu avatar
How can I customize each of the taxonomy term pages?
mw flag

I have a site with Drupal 9. I have created a taxonomy and I want to personalize the terms pages. In Drupal, there is a view for that, but if I change it, I change all the taxonomy term pages.

I want to create a view to customize each page of the terms. How can I achieve this?

Score: 1
mathieu avatar
How to display the parent taxonomy term of the "Tags" field?
mw flag

On my Drupal 9 site, I created taxonomy terms in the "tags" vocabulary (the vocabulary and the default field of the "article" content type) :

enter image description here

When I create a node, I select a taxonomy term in the form (for example "ICO"). The node displays the "tags" field :

enter image description here

I want that if the node has the term "ICO", it also displays the parent terms. Like this :

Catégories : Culture geek, crypto, ICO

How can ...

Score: 1
Confirmation message on comment submission
in flag

When a comment is submitted, no confirmation message is shown and I would like to achieve this. I want to show the following message.

Your comment has been added for review and approval.

I tried this code.

function mymod_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  else if ($form_id == 'comment_comment_form') {
    $form['actions']['submit']['#value'] = "your comment has been ...
Score: 0
griz avatar
How can I show tax per line item at checkout?
jp flag

In D7, there was a module named 'Commerce price by components' which allowed us to display a price inclusive or exclusive of tax. I would like to show a detailed tax breakdown at checkout as most of my store's products are tax exempt, but some are not.

Is it possible in D8 to show the a price inclusive and exclusive of tax as two columns in the checkout summary / review table? Or is it possible to show  ...

Score: 0
bigboy avatar
How to open a field value dynamically in a modal dialog on node view?
gu flag

I have a content type with a field, which contains HTML data (a short article).

When viewing a node, I want to have a link (or button, doesn't matter), which will open a modal dialog with the value of this field when clicked.

Content of the modal (fields value) has to be loaded dynamically. In other words, the content of the modal should be loaded in DOM only when (and if) the link is clicked.

This is  ...

Score: 0
Jason avatar
Entity reference field hidden widget or edit disabled on custom form
in flag

I have a custom node creation form I am rendering within a views preprocess hook. In that form I have two entity reference fields. I am setting the [#value] and [#default_value] of those reference fields programmatically.

On form submit the values I've set are created, but only if the fields are "editable" by the user. I want to make the fields "disabled" and/or "hidden" from the user. Not just h ...

Score: 2
Add a custom variable to an existing block
mx flag
JFK

Is there a way to alter the render array of an existing block? I want to do it for a commerce block (cart block) but the question remains for any core or contrib module block.

When a block uses a custom #theme for it's block, is there a way to alter the definition?

Let's say the module defines the following theme :

/**
 * Implements hook_theme().
 */
function commerce_cart_theme($existing, $type, $theme, ...
Score: 1
863 avatar
How to show progress bar twice on one request (with Batch API)
ng flag
863

I have a custom form which handles two different process after submission, let's say

  • Process 1: removing all article nodes
  • Process 2: importing article nodes from csv.

The problem is that each process have to have its own progress bar.So, it should look like:

  • Form submitted
  • Progress bar for process 1 starts(0%)
  • Progress bar for process 1 finishes(100%)
  • Progress bar for process 2 starts(0%)
  • Progress ...
Score: 4
Smartsheet eng avatar
What is the stable9 theme? When should I use it instead of stable?
um flag

https://www.drupal.org/node/3066038

Has this cryptic statement:

However, defaulting to base theme: stable prevents automatic updates to the next major version of Drupal, since each major version may have a different version of "the stable theme"

and proceeds to list these without any explanation.

The READMEs in the relevant directories are no help.

Warning: Themes that opt out of using Stable as  ...

Score: 1
Steve Siddu avatar
How to add class to multiple view-blocks using twig?
br flag

I have four blocks to a view. I want to add class 'fancy-body' to all four blocks. How can I add that.

view_id : categories

display_id's of blocks : block_1, block_2, block_3, block_4

I know, I can add classes by creating individual twig template file for each block. like this,

block--views-block--categories-block-1.html.twig
block--views-block--categories-block-2.html.twig
block--views-block--categorie ...
Score: 0
usmanjutt84 avatar
Integrate SMTP and recaptcha modules with key module
in flag

I am not a module developer. And I am trying to make key module working with recaptcha and SMTP modules as I see in the video tutorial. I have already setup modules and configured keys by adding files in private directory and was also able to show the dropdowns in recaptcha config form for site and secret recaptcha keys by following key's documentation in the hook_form_alter.

However, I am curious to k ...

Score: 0
bigboy avatar
Filter views by field value equals another field of curent node
gu flag

D9.3. All fields are not referenced, they are just simple integers. All data was pulled from a huge external API and it was not possible to create all references.

Just for ease of understanding, imagine a book database website with books and characters. But each character is presented in one book only.

So, book node has field_book_id, which is numeric, unique, but not NID. Also it has a multiple  ...

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.