I had an issue where I tried to upgrade a Vue project which was built on vue-cli to use Vite instead. Things were fine until I tried to include Tailwind plugin for Vite.
In the last few months, I have worked on expanding my knowledge in web development by learning new technologies. I explored more of the Vue.js world and played around with many new libraries and patterns. Meanwhile working on work stuff I missed a good (or more suitable for me) extension that can fill forms with test data so I decided to put two things together - wanting to learn something new and improve my development workflow.
Drupal 11 will change many functionality related to file validation. One of the changes is the hook_file_validate() which is now deprecated and will be removed from Drupal 11.
Since March 2024, Google consent mode v2 is mandatory. You have two options to make it work: start using some cookie management platform or make your existing solution work with new consent. The most popular module for showing cookie consent in Drupal is the EU Cookie Compliance module.
Are you considering a different admin theme for Drupal, because you dislike Claro? Maybe you are looking for something more modern? There is a contributed theme, which has good support and is currently one of the popular themes - Gin
The best practice for composer dependencies is to keep them ignored in VCS. On some rare occasions, you may need to keep them there. So, how to do it correctly?
How do you update entity display mode to show a newly created field by default? It is easy with configuration import, but what if you need to use hook_update_N?
Programming can be considered as a form of art - like each artist does its own thing it is the same with coding style - each for their own. Sometimes you learn from others, and sometimes you discover it yourself or you combine different ways and see what works well and what does not.
JavaScript plays a crucial role in modern web development, enhancing the interactivity and user experience of websites and web applications. In the context of Drupal, a powerful and flexible content management system, JavaScript is utilized to create dynamic and responsive interfaces, making websites more engaging and user-friendly.
Over time you will extend functionality. Locally things work but then you need to start planning how to update existing environments and then interesting problems will arise.
The hardest thing in software development - is naming. Whether it is a variable, class name, or field naming in Drupal, it might be complicated. I'll write about my naming convention in Drupal that I will use daily basis and what are the benefits.
Drupal has good multilingual support out of the box and it allows to creation of multilingual sites easily. In normal circumstances translation process is easy, but there are some cases where you may want to update translations programmatically.
Enums allow a developer to define a custom type that is limited to one of a discrete number of possible values. Using it as an array key was not that straightforward.
I have worked on multilingual Drupal sites quite a lot but some things still come as a surprise. I have used entity query in some cases but today I did encounter an issue where something did not work correctly.
The Libraries API in Drupal is very powerful and flexible, but it may come with a cost - it may fail in some cases, like the libraries-override definition.
The Cache API is a powerful feature of Drupal, but it might be hard to figure out how to use it correctly. Over time I have seen different ways to do it, but I believe there is a method better than others.
Drupal implements its own Javascript API. Most of the time, all code should use behaviors that trigger every time something changes on the page - page loaded, ajax request, and so on. On the other hand, it causes issues with code executing more than one time.
Sometimes there are cryptic error messages in Drupal, and it's hard to understand what exactly is wrong. I had an issue with custom access in one of the routes throwing BadMethodCallException.
Logging is convenient for storing information about important events in the application. You could use it to find out if any errors occurred, debug issues, and any other important information. In this article, you can find an example of creating and using it in dependency injection.
Tables can be hard to make responsible. Bootstrap, for example, needs a special div wrapper, but it's not easy when dealing with CKEditor. Here you can find the filter plugin that created div around table elements.
Drupal shows all taxonomy term pages as publicly available and lists all related content. In this article, you will find an event subscriber to deny access by default and hook implementation to enable it for some taxonomy terms.
In Drupal, it is possible to create entity types with multiple options - with or without revisions, fieldable or not and these options have a different performance impact when dealing with functionalities that handle a large number of entities in a single process, so you would want it to be as fast as possible.
Views is a core module that has ability to create simple to complex listings from entities. It is possible to optimize them depending on use cases. Let's cover them.
Depending on the type of your project, you may need to deal with update hooks which enable modules programmatically and then modify their configuration. When dealing with configuration updates with hook_update_N(), there is one thing to look out for related to enabling modules programmatically.
Drupal 10 removed old jQuery.once() plugin and replaced it with separate library in plain JavaScript. Existing scripts need to be updated, but there are some things to look out and they won't work as it might be assumed.