custom module

Image
composer

Since starting from Drupal v8.8.0 has removed the Wikimedia merge plugin and replaced it with a Composer 'path' repository, a native Composer feature which serves the same needs as the merge plugin with fewer disadvantages, in this short article, I want to show how to manage dependencies for a custom project.

Image
drupal entities

During a migration of the content and testing the functionality, we are playing a lot with adding/removing menu items for nodes. Here's a snippet on how to delete all links in a menu.

Image
drupal entities

Sometimes we need to completely remove all nodes, for example, when you copy a site for another project. Here the examples.

Image
Drupal Redirects

Sometimes we need to completely remove redirect entities, for example, when you copy a site for another project. Here are two examples.

Image
drupal paragraphs

Sometimes we need to completely remove paragraphs entities, for example, when you copy a site for another project. Here are two examples.

Image
drupal entities

Sometimes we need to completely remove media entities, for example, when you copy a site for another project. Here are two examples.

Image
A custom validator for checking Start time field depending on the value of End Time

In one project I use two independent date fields "Start Time" and "End Time". Both fields are optional, indecencies and don't know about each other. However, if "End Time" is selected, I need to check "Start Time" and display a message, so the first field shouldn't be empty and "End Time" should be greater or equal. This code shows a solution how to implement.

Image
Own custom breadcrumb

When in front of me there was a task to make the site with specific breadcrumbs for specific pages, I applied a very simple and quick solution without the contrib modules. Just a few simple PHP lines in the custom module.

Image
Drupal view - sort Datetime by time only

Working on one project for the KWALL company, we needed to sort the list of TV programs/events by time ignoring the date. We have created a custom views sort plugin for it.

Image
Drupal: Custom Form Layouts

By using layout plugin we can easy to create own layouts for node add/edit forms. In this article a brief instruction on how to create a custom layout for the form.