Latest Drupal related questions

Score: 0
View data export with custom table doesn't work if user is not admin
vn flag

I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it.
For the moment, I've defined a view consuming the custom table data thanks to the Views Custom Table module and it works fine. I've installed the Views Data Export module and configured a display to export data as CSV. This display is attached to the base display.
The CSV button is show on the ...

Score: 1
Joost avatar
Search is very slow for certain roles
jp flag

I'm a bit lost here. I have a strange problem and don't know where to begin. I use the core search function on a website I build. When I am logged in as administrator this search function is working and is very fast. When I log in as one of the users (with other role and permissions) the search function is very slow and sometimes even ending up in a 504 page.

I can't think of a good starting poin ...

Score: 1
Kevin avatar
Custom theme function for a Field
in flag

I want to change a theme hook for one field from a custom FieldFormatter. It's #theme callback is 'field' but I want to give the user the option to toggle a setting that changes this to 'field_raw', which then uses a Twig template with no markup. I can't figure out the theme hook.

Twig template:

{%- for item in items %}{{ item.content }}{% endfor -%}

Module hook:

function mymodule_theme($existing, $ ...
Score: 0
Bouhouch Khalid avatar
Web form Custom element
jp flag

I created a custom webform element, It works perfectly, but when I add a table form element, It is not showing enter image description here

My Code :

    <?php

namespace Drupal\webform_mapper\Plugin\WebformElement;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElementBase;
use Drupal\we ...
Score: -2
How to create a custom layout with for a view, I have tried to print the fields but nothing works I created the template but cant display rows
ar flag

I have a view in drupal 7 but I cant show up the rows, I created a template for the row-style-output but nothing happen.

<?php

/**
 * @file
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, i ...
Score: 0
Andrew Morris avatar
Entity agnostic way of retrieving title
mw flag

Is there a way of the Title/Label/Name of an unknown entity type via 1 method?

At the moment if it's a node, I have to use $entity->getTitle(), for a user it's $entity->getAccountName(), for a taxonomy term it'd be $entity->getName()

In my head they all feel like the same piece of information, is there a way of retrieving it without having to write out possibilities for each type of entity?

Score: 1
Joost avatar
How to find module that is updating my node after insert
jp flag

When trying to create a new book i get the following message:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '53' for key 'PRIMARY': INSERT INTO "book"

The problem here is the book is added twice. Therefor the book is created once and for the other one I get the message above.

For some reason the node creating is updated directly after cre ...

Score: 0
Andrew Morris avatar
Comparing 'old' values in hook_user_update
mw flag

I've got a function which is running on hook_ENTITY_TYPE_update for the user account, but I want to be able to compare against previous values that may have been on the user account, eg see if the user has changed their email address and be able to react to it.

I can see that if I run the debug on the $entity value that is part of the function that there is an 'original' item within the values arr ...

Score: 0
florian_drupal avatar
How to custom access for entity paragraphs_type?
cz flag

I have a problem with entity paragraphs_type, when I add a paragraphs_type in a node, with paragraph items inside, and I set it unpublish status, anonymous users can still see it. unpublished paragraph type I try to custom access by different way :

/**
 * Implements hook_ENTITY_TYPE_access().
 * ENTITY_TYPE : paragraphs_type
 */
function my_module_paragraphs_type_access(
  Drupal\Core\Entity\EntityInterface $entity,
  $op ...
Score: 0
Raja Chakraborty avatar
How can i get the fields of a view which has contextual filter inside views_view_field hook in drupal 9?
in flag

I have a drupal 9 site. I have a parent view A and a child view B. I am using views_field_view contrib module in order to pass an id from view A to view B. I have added a contextual filter in B to get this id from A. I want to fetch this id in my views_view_field hook and do some modifications based on the id fetched. But i am not able to get inside the view B in my views_view_field hook. If i remove th ...

Score: 0
fombo avatar
Use HTTP_REFERER within a twig template
my flag

I have a FAQ page with five nested bootstrap 5 accordions and I need to have one accordion item or another open depending on the page the user is coming from.

I tried using this:

{% set previousURL = app.request.headers.get('referer') %}

but I get nothing.

Using Drupal 9.

Score: -2
Fayaz Mohammad avatar
How to convert hook_entity_property_info_alter in Drupal 8 or 9?
cn flag

I am trying to convert Drupal 7 custom module to Drupal 9. I came across the function hook_entity_property_info_alter(). How can I convert or migrate this function to Drupal 9?

Score: 0
ACanadianCoder avatar
How do I grab a field from a referenced item in views?
br flag

I currently have a view block called Offerings that shows up on all my Course content-type pages that display all the offerings for the said course. These offerings are their own content type called Course Offerings. The Course Offerings content type has a field_course_reference field so to know which Course the offering is for. In order for it to show the proper courses on my view, I have a Contextual Fi ...

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.