logo

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 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:

Drupal 7 hook_block_info() and hook_block_view() display information in the block

17/04/2025, by Ivan

In the previous lesson, we created a module for Drupal 7. In this lesson, we will continue to enhance our module. We’ll add a block output using hook_block_info() and hook_block_view(). This block will display the latest users on the site, each with a link to their profile page.

Let's start with a description of hook_block_info():

Defines all the blocks created by the module.

This hook tells Drupal which blocks the module will display and can also describe block configuration options.