Latest Drupal related questions

Score: 2
Chris avatar
Should post requests revoke my access token when using Simple Oauth?
be flag

I'm using Simple Oauth (4.x) in a headless application which is working well. However, I have noticed that when doing a post request that my access token is revoked, and the next post request will have to refresh the token before making another call. Is this the intended behaviour? I can't find anything in the documentation to suggest it is, but I assume it's there for some security reason.

If it ...

Score: 0
Ivan Ginovski avatar
Show view filters dynamically with AJAX
jp flag

The structure is following:

  • A product content type, with 2 taxonomy reference fields (Category and Origin country).
  • A view that shows products.

Is it possible to show 2 buttons for the Category and Country and when clicked, the appropriate filter exposes itself to the user? Is an additional block a viable solution for this? Or would the module Better Exposed Filters be helpful here?

It could look som ...

Score: 1
Calling a twig template depending on the number of field items
cn flag

I need to call different twig templates of an image field depending on the number of items of this field. If there is only 1 image item, I'd like to use template1.html.twig. If there are > 1 image items, I'd like to use template2.html.twig.

Is that possible? If yes, how?

Score: 3
Drush script memory problem
us flag

I'm running a long drush script and its causing memory problems.

Then I tried debbuging it and I have this very simple code:

$query = \Drupal::entityTypeManager()->getStorage('user');

foreach ($emails as $i => $email) {
    $users = $query->loadByProperties(['mail' => $email]);
    $user = reset($users);

    unset($user);
    unset($users);
}

When I ran the script I noticed that the memory  ...

Score: 0
Interlated avatar
Can I bind ajax to form or document?
km flag

I would like to bind an update to entity browser select.

It is a standard ajax form response. Update the default value of another field.

If I apply the ajax to the inline entity browser form field it breaks the entity browser.

The trigger field is 'field_bond_issuer' the target is 'field_bond_country'. Setting the trigger to the trigger field breaks the selection. The target doesn't work:

 $form['f ...
Score: 0
Wei Zhang avatar
Email notification when new content is created
cn flag

We have been using email notifications in workflow, but now it is not sending mail from creation to next state. We have setup a notification from "any state" to our next state "draft". In fact we have seen a first state called creation which is not possible to delete, and we just want to send an email when a new content is created. For that we create a next state "draft" which is in fact the actual firs ...

Score: 0
Save textarea word count programmatically
cn flag

I'm trying to keep a word count tally on a set of long text fields. As far as I can see, there are several options:

  1. Create a view and add php to a custom template that produces the word count. Most solutions I've found seem too refer back to this 2005 issue, which is considerably out of date.

This would be a viable solution, except none of the code options listed work, and I'm not savvy enough with my p ...

Score: 1
How should I reroll a merge request that has merge conflicts for a contrib module issue?
cn flag

I am trying to reroll a branch called "3226640-link-for-all" for a contrib issue. Note: The intial merge request was created by another user. I am trying to reroll it and maintain the credit to the original user. What I have tried so far:

I got the branch checked out and gained push access. I am trying to follow this guide (Exhibit A): However I have also looked at some more general instructions.

Score: 0
Setting a domain on URL language detection configuration creates an error
in flag

admin/config/regional/language/detection/url

I selected the "domain" option, and set my english to example.com and my french to french-example.com. When I saved the page, I got the error, "Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."

Even though I got that error, it seemed as though the pages were redirecting to the french domain,  ...

Score: 0
mathieu avatar
How do I create a breadcrumb with the taxonomy terms used by the node?
mw flag

I created a vocabulary for the nodes.

screenshot

I installed the Easy Breadcrumb module.

When a node is tagged, for example, with Crypto and ICO, the breadcrumb should be the following one.

Accueil >> Crypto >> ICO >> Node Title

Home >> Term >> Sub-term >> Node Title

Nodes will only have a single term or a term and a sub-term.

Currently it does not work.

screenshot

I also i ...

Score: 0
How to use custom HTML code for a front page
ar flag

I want to use custom HTML code for a front page in drupal 8 but I am a bit lost of how to do it. Is it possible to just insert a piece of HTML code in a basic page content? Or what is the best way to do it? I have full access to the server and I can modify any file if needed. Thank you.

Score: 0
Overwrite/hook VBO action processed message
in flag

Googled so much for this and didn't find a way. I am using VBO to perform custom actions in my view. When a selected action has an error, I print the message using:

\Drupal::messenger()->addWarning('some error message written here');

Hence, when there is any issue with the VBO processing, I get to see both my error message as well as VBO action processed message. Is there a way to overwrite the act ...

Score: 0
How to edit file 'description' label and help text
in flag

I want to edit the file upload description label and the help sentence underneath it:

enter image description here

I tried the below code:

function mymodule_field_widget_form_alter(&$element, FormStateInterface &$form_state, $context) {
  if (isset($element['#field_name'] == 'field_file_description') {
      // Add process callback to change field description.
      $element['#process'][] = 'chg_desc';
    }
  }
}

func ...
Score: 0
Rog Boy avatar
webform reference entity auto complete error
ma flag

In my webform I am using user entity reference view, If I place select-list in field settings it works with format firstname, lastname.

But when I use auto complete it always gives me error when I fill out with firstname,last name as I defined in view.

and works if I only give (name [id:xx]). is it possible to doit in a format (firstname,lastname [id:xx]) ?

Autocomplete
Working: name [id:"1"]
But I ne ...

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.