Latest Drupal related questions

Score: 1
kosher avatar
Allowing users to edit their webform submission
cd flag

I am using Drupal 8.9.17 and Webform 6.0.4.

I have created a webform (registering for an event) that I am attaching to nodes (events). On the webform, I have checked "Allow users to update a submission using a secure token." And I have limited users to 1 submission per source entity.

All is good so far, but I would like the "Per user submission limit message" to say "You have already registered for  ...

Score: 0
khadidja avatar
List all values in same row in a view
cn flag

I have a view that displays the authors of an article and links to their author page.

Currently the view outputs each author in its own row as a list. I'd like to have it display the authors in one row separated by commas.

It's currently outputting like this:

Suzanne Smith

Jack Johnson

Alex Anderson

I'd like it to output like this: Suzanne Smith, Jack Johnson, Alex Anderson

I came across this question wh ...

Score: 2
Free Radical avatar
What is the route for a specific node?
kz flag

I want to override the user.login route that points to the default login page.

I.e. I want that a user who presses the default "Log in" link for the site to be directed to a node that provides some help (where the user can click on a link and arrive at the standard log-in form).

Say that the path I want to redirect to is /node/42. How can I find out what route to return for a specific node?

I beli ...

Score: 3
sonfd avatar
How can I build a render array that results in a string rather than a Drupal\Core\Render\Markup object?
in flag

I'd like to use Twig Tweak's drupal_view() to render a view in my paragraph template. I have a couple entity reference fields on the paragraph and need the IDs of the referenced entities passed as contextual filter arguments.

I built a Contextual Filter String field formatter to format the contextual filter string with the hope that it could be passed directly as the argument's value. The formatter w ...

Score: 0
Kevin avatar
Provide custom Webform element with no user-facing options?
in flag

Is there a way with Webform 6 to create custom element plugins that do not have any user-facing options?

For example, creating a select element that is usable in webforms, but its option list comes from a remote API - therefore does not need the editors to enter values in the UI?

Score: 0
mogio avatar
Rerun behaviors
cn flag

In order to output the SearchApiAutoCompleteFormBlock (view) within a modal, we lost the bound JavaScript events on the input. In other words, the DOM element (<div>) for the block was recreated by JavaScript after Drupal adds the events.

Now we need to rebind the events for the autocomplete.

This is the behavior of the Search API autocomplete module.

Drupal.behaviors.searchApiAutocomplete ...
Score: 0
Harshit Thakore avatar
Admin custom configuration form add more field issue
cn flag

I have created below admin custom configuration form by taking a reference of below examples:

  1. https://git.drupalcode.org/project/examples/-/blob/8.x-1.x/form_api_example/src/Form/AjaxAddMore.php
  2. How do I add a "Add more" button?

My custom form is rendered correctly on first time load but when i click on "Add Product" button nothing happen. As per example the form should rebuild again and prepend the ...

Score: 0
Renato Francia avatar
WebformMapping Element implementation in webform handler
id flag

This might be a basic question, but I'm trying to implement WebformMapping to a webform handler to display all the webform fields and map them to a 3rd party API on the configuration form.

Making something like this.

enter image description here

After some digging, I found these two threats:

Score: 0
Greg Sims avatar
Update Alias Programmatically
us flag

I have a large website with 240 urls that need to be updated. I would like to do this programmatically to avoid making errors. I created the following function which seems to work. There seems to be a good bit of complexity here for what I am trying to accomplish. Is there a simplier way to update the url of a node?

function alias_replace($path, $lang, $new_alias) {

  $path_alias_manager = \Dr ...
Score: 0
Using Drush 10 and sql-sync with path based sites not working
in flag

We have two websites running off a single domain:

https://www.mywebsite.com

https://www.mywebsite.com/mywebsitetools

Both websites have their own databases and are hosted by Acquia.

We've been using Drush 8.x and the sql-sync command for the past number of years to synchronizing the database between the local environment and Acquia.

Last week we upgraded to using Drush 10.3.6 and now we're running i ...

Score: 0
user agent avatar
Load css and js assets as absolute paths during twig render
eg flag

By default, Drupal 8 loads css and js libraries using relative paths.

ie: /core/modules/contextual/css/contextual.module.css

However, because I want to generate static pages to be used by another consumer, how can I have all my libraries as absolute paths instead?

I thought of using the css_alter hook and my code is below:

function rint_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterfa ...
Score: 0
Rick_P avatar
Possible use case for hook_views_query_alter or hook_views_data_alter
hk flag

We have an Event content type that uses a custom module to allow events to occur on more than one date. We have a View of teasers that displays a list of all upcoming events, each teaser displays all the occurrences the event will take place. The only problem is, the View displays each event one time in the list for each occurrence, but we only need it to show once because it already displays all the da ...

Score: 0
How can I use contextual filters to display a block with field values from a single related entity?
pe flag

I've found various recipes/threads with the scenario where have a content type A node and want to display in a sidebar block, all the related content type B nodes, with the relationship based on an entity reference field on content type B. Example and another

I've attempted to adapt these instructions to my situation, without success. My case is sort of flipped.

Content type: Resource
Content type: Sour ...

Score: 1
sonfd avatar
Should I use Aggregation or Query Settings > Distinct to remove duplicate results?
in flag

I have a basic view that displays published article teasers. The view has a contextual filter on the article content type's tags field, e.g. field_tags. The contextual filter is configured to accept multiple ids, e.g. 1+2+3 for OR.

When I pass 1+2+3 for the contextual filter's value, if an article has more than one of the passed values in field_tags, the article appears multiple times in the results.

Score: 0
youni avatar
Display in f2 only terms related to selected term in f1
cn flag

I have a site that consists of a few parts like: Cosmos, Hi-tech, Travel, Music.

Each part has its own Categories. And I have made two Taxonomy vocabularies:

  1. Part of a site
  2. Categories (this has field 'Part of a site' and every category term has selected 'Part of a site' term)

Both Vocabularies are using in Node as Field 1, and Field 2.

But it is not convenient now to choose Cetegory term because categor ...

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.