Latest Drupal related questions

Score: 0
mauzilla avatar
Cannot get any output when passing array through preprocessor
cn flag

In my preprocessor I assign the following:

$variables['myVar'] = "value";

And in my twig file I can do the following and I get the value printed:

{{ myVar }}

If I however assign an array like this in my preprocessor:

$variables['myVar'] = ['name' => 'John','surname' => 'Doe'];

I am not able to get any output either through the outputting the variable, doing a dump or even trying to run it th ...

Score: 0
MadzQuestioning avatar
hook_theme_suggestions_node_alter() doesn't work for new files
cn flag

I implemented hook_theme_suggestions_node_alter() and added a new suggestion for a custom template file. In the inspector, I can see the suggestion is picked up. I created that file, but it doesn't seem it's loaded.

The module is inside modules/custom/gf_them_module/ and the custom theme is in themes/custom/gf_theme/. The new file, node--products-template--simple.html.twig, is in themes/custom/gf_theme ...

Score: 1
Using Twig template to generate a PDF
uz flag

I am trying to generate a Twig template for the Attachment PDF item in a webform. I am able to automatically generate a label and field data using : {{ webform_token('[webform:element:to]', webform) }} : {{ data.to }}

I am trying to figure out how I can get access to the rest of the webform settings such as the labels of the different fields: {{ webform_token('[webform_submission:created]', webfor ...

Score: -2
Yuseferi avatar
Generate static files of specific nodes with Tome
cg flag

I'm looking for a way to generate a static version of specified nodes ( in my case they are book nodes pages).

I want to do it periodically in my custom Drupal cronjob,

most of the Drupal static modules are obsolete and there is no version for Drupal 9.

I found TOME module but looks like it's mostly for generating full website static generation through admin panel or drush command line.

I tried drush ...

Score: 2
mauzilla avatar
How can I load the last nine created nodes?
cn flag

I want to get the latest nine nodes in a preprocess hook. I am using the following code, but it returns all the news nodes.

$entities = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['type' => 'news']);

Is it possible to load only the last nine created nodes using loadByProperties()?

Score: 0
Tobias Krause avatar
How do I get the edited paragraph in hook_field_widget_WIDGET_TYPE_form_alter()
cn flag

I use hook_field_widget_WIDGET_TYPE_form_alter() to alter the form for a single paragraph. What I do not understand is how I know which paragraph currently is edited when this hook is called. The problem: I want to change the default value for a field of the paragraph but only when no field value was set so far. So only when the paragraph gets created the default value should be changed as it is another ...

Score: 0
Getting error while adding/rearranging sort in Views. Drupal\Core\TempStore\TempStoreException: Couldn't acquire lock to update
kr flag

I am trying to add/rearrange a sort criterion in view in drupal 8.x, but getting error - Drupal\Core\TempStore\TempStoreException: Couldn't acquire lock to update item 'search' in 'tempstore.shared.views' temporary storage.

Is there anyone who can help in this regard. Thanks in advance!

Score: 1
Klaycon avatar
How do I decide where to put these fields in a Commerce License architecture?
in flag

I'm creating a License Type using Commerce License. It will allow a user that owns a group to purchase seats on that group for other users. Therefore, at purchase time, I need to associate a group owned by the user with the license or order somehow. Then, later, I will have routes that can be used by the license owner to assign that group seat to a user.

My question is, where do I actually store this i ...

Score: 0
Bavramor avatar
Contextual filters don't work with url aliases
sg flag

I use contextual filters in a view to get the node ID from the URL (for example, node/6716/v1-vv-autor).

These are contextual filters settings.

screenshot

I would like to set a URL alias for the node, set using part/[node:title] as pattern.

The path I am using for the view is part/%/v2-vv-authors, which should also match http://landwehrcie.de/part/ich-bin-daniel/v2-vv-autoren.

The contextual filter doesn' ...

Score: 0
quantumized avatar
How to create a custom Views filter to filter nodes on a field value (string) if it's in multi-value field on the user's profile?
ng flag

We have a Drupal 9 site where we need to filter a view showing nodes where their "US State" field value is contained in the user's "Assigned States" multi-value field.

Node: "US State" field is a plain text list single value field: "node__field_state_new"

User: "Assigned State(s)" is a multiple value check box field: "field_assigned_state"

We've created a custom filter but are stuck on getting it t ...

Score: 0
mauzilla avatar
Cannot get hook for custom twig template to work
cn flag

I have a custom template with the following twig file:

views-view-unformatted--offices_contact_us_page_.html.twig

The view is added as part of extra fields module inside of a Drupal paragraph. I have tried everything but simply cannot get the hook to work, however, the .theme file is loaded correctly as I can add an exit to the preprocess_page() function and that works.

I have tried:

  1. _preprocess_vie ...
Score: 1
jhnc avatar
security updates reported but not actually available (recommended==installed)
cn flag

I installed Drupal 9.3.6.

At /admin/reports/status, I see the error:

There are security updates available for one or more of your modules or themes

and at /admin/modules/update, two modules are listed: PHP 8.x-1.1 and Remote Stream Wrapper 8.x-1.5.

However, for both these modules the recommended version is the already-installed version.

  • How do I see more details about the reason for the errors?
  •  ...

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.