Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Working with a Database in Drupal 7 - Lesson 5 - Extenders

17/04/2025, by Ivan

Select queries in Drupal support extenders. An extender allows you to add functionality to a SELECT query at runtime. This functionality can either be a new method or can override the behavior of an existing one.

This is achieved using object-oriented programming design patterns. Extenders implement the Decorator Pattern, attaching additional responsibilities to a dynamic object by providing a flexible subclass-like extension of query methods.

Working with a DB in Drupal 7 - Lesson 6 - Changing a Query on the Fly (hook_query_alter)

17/04/2025, by Ivan

An important feature of dynamic SELECT queries is that other modules can alter these queries on the fly. This allows modules to insert their own instructions into a query, influencing its behavior or applying changes during execution—such as enforcing node access permissions. There are three components involved in altering queries on the fly: tagging, meta data, and hook_query_alter().

Working with Database in Drupal 7 - Lesson 8 - Insert Queries (INSERT INTO)

17/04/2025, by Ivan

Insert queries should always use the query builder. Some databases require special handlers for LOB (Large Object, such as text in MySQL) and BLOB (Binary Large Object) fields, so an abstraction layer is necessary for individual DB drivers to implement these handlers.

Insert queries start with the db_insert() function:

Working with a Database in Drupal 7 - Lesson 9 - UPDATE Requests

17/04/2025, by Ivan

Update queries should always use the query builder. Different databases have specific handlers for LOB (Large Object, such as TEXT in MySQL) and BLOB (Binary Large Object) fields, so an abstraction layer is required for individual database drivers to implement these specifics.

Update queries must start with the db_update() function:

Working with Database in Drupal 7 - Lesson 10 - Delete Requests (DELETE)

17/04/2025, by Ivan

Delete queries should use the query builder. They begin with the db_delete() function:

<?php $query = db_delete('node', $options);
?>

This delete query will remove records from the node table. Note that you do not need to wrap the table name in curly braces—Drupal's query builder handles that automatically. Delete queries use a Fluent API, meaning all methods (except execute()) return the query object itself, just like update and insert queries.

Working with Database in Drupal 7 - Lesson 11 - MERGE Queries

17/04/2025, by Ivan

Merge queries are a special hybrid type of database query. While the syntax for these queries was defined in SQL 2003, few databases actually support it. However, most databases offer an alternative implementation using specific syntax. The merge query builder in Drupal abstracts the concept of a merge query into an object structure, so it can be compiled appropriately for each database based on its own syntax.

Working with a Database in Drupal 7 - Lesson 12 - Query Conditions (WHERE, HAVING, LIKE)

17/04/2025, by Ivan

The WHERE clause in a query allows you to select only those records that meet certain conditions—for example, nodes created no earlier than two weeks ago, or taxonomy terms containing the word “Drupal”. In SQL, we use WHERE and HAVING to specify conditions in SELECT, UPDATE, and DELETE queries. In Drupal’s dynamic queries, there's a built-in mechanism for handling query conditions, and it works the same across SELECT, UPDATE, and DELETE operations.

Conditional Expressions Concept

Conditions are represented as special expressions that define constraints.

What does a Drupal 7 module consist of?

17/04/2025, by Ivan

Before we start creating our module, I want to share a bit more about the capabilities of the Drupal API. The API provides powerful tools for working with taxonomy, nodes, users, and database input/output. To allow communication between modules and the Drupal core—or between different modules—Drupal provides a hook system. A hook is a callback: when code execution reaches a hook, our module’s function is included in the execution flow. This allows us to process user data, menus, taxonomy, and content types.

Visit: