Skip to main content
Home
Drupal life hacks

Main navigation

  • Drupal
  • React
  • WP
  • Contact
  • About
User account menu
  • Log in
By admin, 26 June, 2025

How to Efficiently Load and Process 10,000 Nodes in Drupal Without Killing Performance

If you need to retrieve data from 10,000 nodes in Drupal, the most efficient way is to load them in batches, not one-by-one in a loop and not all at once.

Tags

  • #Drupal Planet
By admin, 23 June, 2025

Mastering OOP and SOLID Principles in PHP with Drupal Examples: A Complete Guide

Object-Oriented Programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data (fields, often called attributes or properties) and code (methods, which are functions associated with the object).

There are 4 main principles of OOP, often remembered by the acronym "PIES":

🔠 What is PIES?

PIES stands for the four core OOP principles:

Tags

  • #Drupal Planet
  • OOP
  • SOLID
By admin, 26 May, 2025

Combining Tailwind CSS and Bootstrap (Radix) in a Drupal Theme: A Step-by-Step Guide

Introduction

Modern frontend requirements in Drupal projects demand more flexibility, customization, and fast adaptation to design specifications. Tailwind CSS is a utility-first CSS framework that enables developers to build unique UI solutions quickly and precisely without writing extra CSS. However, many Drupal projects still use the Radix theme, which is based on Bootstrap—a reliable framework with a rich set of ready-made components.

In this article, we'll cover:

Tags

  • #Drupal Planet
  • Tailwind
  • Bootstrap
  • Radix
By admin, 10 April, 2025

Laravel for Drupal Developers: Comparing Eloquent and Entity API

Direct comparison between Laravel (Eloquent) and Drupal (Entity API) — especially useful if you're coming from a Drupal background and exploring Laravel.

🔁 Laravel Eloquent vs Drupal Entity API

✅ Fetching filtered content

Laravel:

$tasks = Task::where('completed', true)->get();

Drupal:

Tags

  • #Drupal Planet
  • Laravel
  • Eloquent
By admin, 22 February, 2025

Why Using current_route_match in Access Checks is Problematic

If you inject the current route match service (current_route_match) and use it inside an access() method, your access check will only work when the user is actually visiting that route in the browser.

However, if access is checked programmatically from another page (e.g., via an access API or a block), the current route match will be from that other page, not the one you actually want to check access for.

Tags

  • #Drupal Planet
  • Access Check
By admin, 26 January, 2025

To create a custom ddev command for running php bin/magento in a Magento project

To create a custom ddev command for running php bin/magento in a Magento project, follow these steps:


1. Open the .ddev/commands/web or .ddev/commands/host directory

This is where custom commands for ddev are stored.


2. Create a new file for the command

Create a file named .ddev/commands/web/magento (no file extension) and add the following content:

Tags

  • DDEV
  • Magento
By admin, 4 December, 2024

How can AI help in understanding regular expressions using Drupal examples?

Researching regular expressions with the help of AI using examples from Drupal functions allows us to understand how to efficiently analyze and process text data in Drupal, including searching, replacing, filtering, and other operations. Regular expressions (regex) are a powerful tool for working with text, and their use in Drupal plays a key role in various functions such as input processing, data validation, content parsing, and much more.

Let's look at examples of regular expressions used in Drupal and how AI can assist in their analysis and optimization.

Tags

  • #Drupal Planet
  • Regular expressions
By admin, 8 November, 2024
A flowchart diagram showing how external or custom data is exposed to Drupal Views using hook_views_data(). The process begins with hook_views_data(), then moves to defining a virtual table, registering fields, passing data into the Views UI, adding fields, and finally enabling display, filtering, and sorting of the data.

Exposing External and Custom Data to Views with hook_views_data()

When we want to make data available to Views, we need to define it in a way that Views can interpret. For content entities, the EntityViewsData::getViewsData() method accomplishes this, making data accessible for Views. However, when working with custom data, we use hook_views_data() to define how Views should handle it.

Tags

  • #Drupal Planet
By admin, 7 November, 2024

Configuring a Custom Permission Provider Service in Drupal 9/10 Modules

This is a YAML configuration for a service, likely in a file like my_module.services.yml, which defines services in the my_module Drupal module.

Here's a breakdown:

1. my_permission_provider — This is the name of the service you’re creating to provide custom permissions.

2. class: Drupal\my_module\MyPermissions — This specifies the class implementing the permission logic. Here, it uses the MyPermissions class within the Drupal\my_module namespace.

Tags

  • #Drupal Planet
By admin, 28 October, 2024

Secrets of Secure Development in Drupal: Key Functions

  public static function filter($string, ?array $allowed_html_tags = NULL) { 
    if (is_null($allowed_html_tags)) { 
      $allowed_html_tags = static::$htmlTags; 
    } 
    // Only operate on valid UTF-8 strings. This is necessary to prevent cross 
    // site scripting issues on Internet Explorer 6. 
    if (!Unicode::validateUtf8($string)) { 
      return ''; 
    } 
    // Remove NULL characters (ignored by some browsers). 
    $string = str_replace(chr(0), '', $string); 
    // Remove Netscape 4 JS entities.

Tags

  • #Drupal Planet

Pagination

  • First page
  • Previous page
  • …
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Page 8
  • Page 9
  • Page 10
  • Page 11
  • …
  • Next page
  • Last page
Powered by Drupal