Latest Drupal related questions

Score: 0
Sven V avatar
Limit view path to one domain
cn flag

I currently have a Drupal 9 site running with Domain Access and a view with a relative path like contact. The site currently has two domains, linking the page to both domains like so:

  • sub.domain.com/contact
  • sub2.domain.com/contact

How can I limit this view to sub.domain.com/contact only?

Score: 0
rd89 avatar
Theming mime mail rule email send
tk flag

I've got a rule that fires properly and sends an email after a comment is saved. I want to theme this specific rule using the documented method.

My template name: mimemail-message--rules--ticketcomments.html.twig

I created a mail system module with the same "key" name.

Theming to the mimemail-message--rules.html.twig does work.

What am I missing?

Score: 0
Tom Aston avatar
The service "redirect.request_subscriber" has a dependency on a non-existent service "path_alias.manager"
ar flag

We have inherited a Multisite Drupal setup and are managing the migration for a client. We have the codebase set up locally and have two of the sites up and running. We are hitting an error on the third though:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "redirect.request_subscriber" has a dependency on a non-existent service "path_alias.manager". in Symfony\Com ...

Score: 0
May  avatar
hook_form_alter makes js on every other form not work
zw flag

I use hook_form_alter() to alter a field.

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

It changes the field value to new value, but the problem is that, as soon as I enable this module, the JavaScript on forms stops working. For example drop-downs, autocomplete, AJAX no longer works.

I cant understand ...

Score: 2
Andrew Morris avatar
Return AccessDenied for custom page
mw flag

I've setup a custom page in my system which is expecting 2 parameters that will be used to generate part of the content on that page, I'm able to retrieve the information from my page, but I'm wondering what is the best method of returning an access denied when my criteria fail

I found this page which shows how you can setup a custom access controller, but this example is passing the user entity, when w ...

Score: 0
MacSim avatar
Copy a ckeditor instance value to another field
um flag

In a form I have a ckeditor field and I would need to copy its value to another field using a jquery blur event. Do you guys know how I could do that? I was thinking about a ckeditor plugin but I don't think I will be able to interact with another field from that plugin.

Score: 1
Alex Monaghan avatar
Custom entityquery sorting
in flag

I have a normal "surname" and "firstname" fields, however I need something more than

->sort('field_surname', 'ASC')
->sort('field_firstname', 'ASC')

The surnames are old English names and contain prefixes to the names so a surname of "St John" would need to be sorted as "Saint John" to appear in the list in the correct place.

Other examples could contain an apostrophe which would need to be removed ...

Score: -2
abelass avatar
Inline Entity Form: alter autocomplete
nl flag

I need to alter the display of the "Add an existing node" autocomplete response:

  • Add the content type and some more information form the content (location), display the result on two lines.
  • Initiate the autocomplte only if al least 6 characters are entered
  • alter the query sort (ORDER BY changed)

Which is the best way to to this ?

Score: 1
Sarah C avatar
Check for block type in THEME_preprocess_menu_local_task
za flag

I want to make changes to local task tabs of a certain custom block type (mini_layout).

I can do this for certain node types in my theme with THEME_preprocess_menu_local_task(), and there I can use the following to check the node and node type first.

$node = \Drupal::routeMatch()->getParameter('node');
if ($node && $node->getType() == 'content_type') {
  // my code
}

But how do I chec ...

Score: 2
quantumized avatar
Why are cookies being caches in hook_prepress_node() and how can I prevent or work around this issue?
ng flag

In Drupal 9 we have a _preprocess_node() hook that loads a users cookies like:

function THEME_preprocess_node(&$variables) {


  $parameters = [];
  if (isset($_COOKIE['utm_source'])){
    $parameters[] = 'utm_source=' . $_COOKIE['utm_source'];
    $parameters['#cache']['contexts'][] = 'cookies:utm_source';
  }
  if (isset($_COOKIE['utm_medium'])){
    $parameters[] = 'utm_medium=' . $_COOKIE[' ...
Score: 0
jdcllns avatar
How do I create sell product samples on the fly?
in flag

Our site sells fabric by the roll, not by the yard. Each roll is a unique one-off. Due to inconsistencies with color, we offer samples. It's unfeasible create sample Products for each roll Product we post. What I envision is adding a "Get A Sample" link or button to each product's page that would, when clicked, capture the product's ID, then add a sample with that ID to the Cart.

I've been playin ...

Score: 0
jdcllns avatar
How do I selective limit Product Attribute values when using them as an Exposed Filter in a Product list View?
in flag

I'm using the Commerce module 2.x.

What I have:

  • Product Category taxonomy List of product categories

  • Product Color product attribute List of product colors It has a Product Category entity reference field that associates the color with particular product categories because all products are not offered in all colors.

  • A product variation type that has a Product category entity reference field that a ...

Score: 1
May  avatar
How to wrap select list in custom html?
zw flag

I have a select list created by views exposed filters.

When I debug the templates used. I have the exposed filter template, then the select list is in a seperate template.

I tried just putting my html in the exposed filter around {{form}}. This put the html around the whole form, including labels, other containers etc, which didn't work for my situation.

So I am trying to target the select list directl ...

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.