Latest Drupal related questions

Score: 0
liquidcms avatar
How can I access row field values in the parent views template?
us flag

In views-view-fields--myview.html.twig I can print a views fully formatted/rewritten field with a variable like: {{ fields.field_my_view_field.content }}.

I am wondering if there is some way to print fields in the same fashion in the parent view template: views-view--myview.html.twig. This would require having access to these variables with the sub items (row) of the {{ rows }} variable.

Is this possible? ...

Score: -1
View page showing users through a leaflet map triggers request timeout error
in flag

I'm building a view displaying users in a leaflet map.
Specifically, the view has the following settings:

  • The format is Geolocation CommonMap showing fields.
  • The fields selected are first name, last name and geolocation field; in the filter criteria I've selected some user fields plus some Profile fields (the Profile entity is linked to the User entity through a relationship)
  • There is no paginatio ...
Score: 0
Webform upload files issue
ng flag

I have setup our site to allow files to be uploaded and attached to the submission of the webform. I have the private directory setup with the .htaccess file. That part seems to be ok because when I add the upload element to the webform it creates a folder in the private directory and adds a sample file to it. When I try to use the form and add files to be uploaded and then submit the data it give me th ...

Score: 0
Bohus Ulrych avatar
How to get node information in RouteSubscriberBase::alterRoutes
jp flag

what I'm trying to achieve, is to for some specific nodes set admin theme. I have defined RouteSubscriberBase but how can I get node information here? This code is not working $node = \Drupal::routeMatch()->getParameter('node');

$route->getPath() will return /node/{node}

class RouteSubscriber extends RouteSubscriberBase
{

    /**
     * {@inheritdoc}
     */
    public function alterRoutes(RouteCol ...
Score: 0
jitendrapurohit avatar
Retain sites//files path for cdn urls
ph flag

I just updated the cdn module and seems the CDN urls formed for pdf (and other) attachments have been updated with the /public/ keyword.

Before:

https://cdn-domain/de/cdn/farfuture/<token_string>/sites/de/files/2022-05/file_name.pdf

where de is a multisite alias.

After the module upgrade the new path is rendered as

https://cdn-domain/de/cdn/ff/<token_string>/public/2022-05/file_name.pdf
 ...
Score: 0
Access Denied for programmatically added file to a node
in flag

I have a custom script that imports contents from an external database. I'm attaching files using the below custom code.

$file = File::create([
  'filename' => $new_filename,
  'uri' => $folder_uri . '/' . $new_filename,// private://my_content_type/<subdir>/filename.pdf
]);
$file->setPermanent();
$file->save();

Once the above part is complete, then attach that file(s) to the new node ...

Score: -2
fombo avatar
502 Bad Gateway on editing or creating only for one content type
my flag

Drupal 9 project. I can create and edit all content types but one. I get a 502 Bad Gateway from Nginx. Theese are the logs:

2022-05-05 10:39:11 Error   ***.**.***.***  503 GET /node/6095/edit?destination=/admin/content HTTP/1.0 https://dev.mywebsite.com/admin/content Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 20.8 K  Acceso SS ...
Score: 2
Node ID caching on hook_form_alter()
in flag

I have a webform with an email field. I am embedding the webform on each node, with a field on the node for the email address.

I implemented hook_form_alter() in my .theme file that loads the node using $node = \Drupal::routeMatch()->getParameter('node');.

I can then load the node and get the proper email address and set it in the webform. The problem is that the node is cached for anonymous users. I ...

Score: 1
Kevin avatar
Create a Context/Condition and get a view display used on the page
in flag

I want to create a context/condition plugin that checks the total results returned from a view display on the page (its a block), and if its less/greater than a certain figure, hide certain peripheral display elements.

I cannot seem to find a ContextDefinition for the view being executed, does this exist? Do I need to grab the context from the Block itself? How?

Score: -2
pglatz avatar
Display paragraphs field as a table?
in flag

Is there a way to display the output of a multiple value paragraphs field in a node as a table? The paragraphs has three fields in it, and I would like to display with labels in the header row, and content rows containing the data for each row in the paragraph.

Score: 0
thiokol avatar
What event is triggered when adding an order line item manually from orders admin page?
cn flag

I cant seem to find the correct event that is called when an admin manually creates an order item by clicking the 'Add new order item' button at: /admin/commerce/orders/430/edit

I believe it should be one of the events listed here:

https://github.com/drupalcommerce/commerce/blob/8.x-2.x/modules/order/src/Event/OrderEvents.php

ORDER_ITEM_CREATE seems like the one i need, but its not triggered when add ...

Score: 0
Cameron avatar
Webform Conditions for a multi valued select
cn flag

I'm making a quiz utilising Webform. I would like to use a multi-valued select list for one of the questions, and want to grade the user on any combination of correct answers selected.

Using the Webform Image Select element's default Cute Kittens as an example, for the values of the select:

  1. kitten_1
  2. kitten_2
  3. kitten_3
  4. kitten_4

I'd like to be able to say a particular combination of selections is the rig ...

Score: 0
ewik avatar
Warning: file_put_contents(): Filename cannot be empty
fi flag

After updating Drupal 8 to Drupal 9, the following error is displayed on the website page:

Warning: file_put_contents(): Filename cannot be empty in /var/www/html/web/modules/contrib/devel/src/DevelDumperManager.php on line 108

Although it is not in the logs. But there is a similar one:

Warning: file_put_contents(): Filename cannot be empty in Drupal\search_api_solr_devel\Logging\SolariumRequestLogger- ...

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.