Latest Drupal related questions

Score: 5
Michael Chen avatar
Extending contrib module filelog service class displays PSR implementation error
nl flag

I wanted to override the logger.filelog service from filelog module to make use of my own parser.

An error occurred through drush cim and drush cr when the new custom module that overrides the service is enabled.

The website encountered an unexpected error. Please try again later.
Symfony\Component\DependencyInjection\Exception\LogicException: Service 'logger.filelog' for consumer 'logger.factory' doe ...
Score: 0
Lia avatar
How to copy fields from an entity to another for same type entities?
in flag
Lia

I have 2 entities of the same type & bundle but used in 2 different cases (linked differently to different entities). Upon publishing the second entity, I want to get the new data and put it into the 'main' entity since all logic is built based on the main entity and interacts with other sorts of things.

What I have so far:

 $fields_to_exclude = [
  'id',
  'uuid',
  'vid',
];

foreach ($second_en ...
Score: 0
pglatz avatar
Show links for all the views in the administrator menu
in flag

With the admin toolbar enabled, one of the things I miss from Drupal 7 is hovering through the administrator menu on Structure >> Views and seeing a list of all views and being able to click on one to edit it.

See this screenshot for the current behavior.

screenshot

Is there a way to provide this feature from a custom module? I know I can get a list of all views with Views::getAllViews() but I am not  ...

Score: 0
Joost avatar
--2 is appended to the block ID
jp flag

I have a strange problem. After upgrading a website from D8 to D9, some of my block IDs are changed. Some of them now have --2 behind the ID. This is messing up my styling and scripts. And I'm wondering how this can happen and if there is a simple solution for it. I found this issue without any solution other than changing my CSS and JS files.

I know Drupal sometimes changes ID after and Ajax call, this n ...

Score: 0
May  avatar
Why are the images referenced using a relative path instead of an absolute path?
zw flag

I have installed my Drupal site on my localhost under a path like /websites/mysite/drupal. Most files get loaded correctly, such as those at /websites/mysite/drupal/sites/default/files.

For some reasons, if I have images in a module or theme folder, such as /websites/mysite/drupal/module/custom/mymodule or /websites/name/drupal/themes/custom/mytheme, they do not get loaded. In this circumstance,  ...

Score: 2
Page with multiple displays on the same path does not respect the different access rights
hm flag

With Drupal 7, it was possible to define in Views a page with several displays, having all the same URL. By ordering the displays in descending order of access level (Administrator first, Anonymous last), it is possible to have different renderings depending on the role of the logged in user. This allowed for a single menu entry that displayed only the data to which the user is entitled. This doesn't se ...

Score: 2
lazarcelic avatar
Number field type for specific format
cn flag

I have to store number data into database in format xx-xxxxxx-xx for example I have xml data in format: ISBN="10-000000-701" ISBN="11-000000-002" ISBN="11-000000-004"

and I need to store that number in db field but I don't know what field type to use. Any help?

Score: 0
Alireza Tabatabaeian avatar
Redirect to offsite payment gateway when implementing headless commerce
cn flag

I'm implementing a Drupal 9 commerce 2 Headless Project (FrontEnd is an android app written in Kotlin so it does not accept cookies and I work with Tokens). I can access and modify user cart using Commerce Cart API, I also can patch many order information like billing and shipping in a decoupled manner, the only problem is offsite payment plugin posts information (like API Key or Password or ...) to Of ...

Score: 1
Jaswin Singh avatar
Injecting service into another service does not work
jm flag

I have to override pagecache service in order to have some custom validation logic to be executed for anonymous users. The issue is that I have the domain module's service domain.negotiator to be injected into pagecache service, but when I call the domain.negotiator service it is always null no matter what I do. I think it has to do with something with priority. I can confirm the overridden service is bei ...

Score: 0
shyammakwana.me avatar
Show taxonomy field in View
do flag

I have taxonomy called Hardware Type and it has field Short Code. Now content-type Hardware's has this taxonomy and I have a page which lists all Hardware. I want to show Hardware type's short code field but option is not available under fields.

What are the possible solutions to this?

enter image description here

Score: 0
What is langcode in config export used for?
cn flag

When exporting configuration into .yml files with drush csex, some files have a langcode property set. After some weeks or months of working with the system, they sometimes disappear in some files when exporting again.

My questions:

  1. Why do configuration files need the langcode at all?
  2. What can be the cause for the appearing/disappearing langcode in the exported config files?
Score: 0
Tushar avatar
How to remove addtoany js for a particular node page?
nz flag

I need to unset addtoany module js for a particular node.

For that I have implemented

 function theme_name_js_alter(&$javascript) {
    if(\Drupal::service('path.matcher')->isFrontPage()) {
            unset($javascript['https://static.addtoany.com/menu/page.js']);
            unset($javascript['modules/contrib/addtoany/js/addtoany.js']);
            unset($javascript['themes/test/js/index.js'] ...
Score: 3
Yuseferi avatar
How to filter book pages by book with Views? ( how to integrate book with views)
cg flag

At the moment on Drupal 9.3 there is very poor integration between views and Book Module.

how to create a view to show all the book pages with functionality to filter ( an exposed filter) them by book?

in another word, how to integrate the book module with views to show a list of the book page and filter them ( exposed filter) by book?

Score: 0
Jim D avatar
Webform HTML Email Fine on localhost with MailHog, Just Text on Server
kh flag

I Developed a webform on my localhost, testing the Email using Mailhog. Everything looks fine, nicely formatted html emails. When I moved it to my test server at A2Hosting, the emails all show as text. Using Drupal 9.2.7, Webform 6.1.2. I am not using any additional mail modules, just what comes with Drupal and Webform.

To move to my A2Hosting site, I just made a tarball, extracted, reloaded  ...

Score: 0
Filtering webform submission results in a template file or in Views
tg flag

(Drupal 7) My situation is the following: I am using one single webform on my Drupal page that shows up on the page in different places for different events and gets a unique ID for each event to group results by. So when someone submits it to register for event A, the result will have ‘A’ as its event ID in the submission table; when someone registers for event B (on a different part of the page),  ...

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.