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

Blog

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.

hook_permission Drupal 7 access permissions for different roles

17/04/2025, by Ivan

In previous lessons, we displayed pages and blocks in various places, and we also used the properties 'access arguments' and 'access callback' to set access restrictions for pages. In this lesson, we’ll create a more flexible way to manage access rights to operations via administration pages. For this, we’ll use hook_permission() (in Drupal 6, it was hook_perm()).

hook_permission()

Defines permissions for users.

Form API Drupal 7 creating forms on Drupal

17/04/2025, by Ivan

In previous lessons, we got acquainted with the hooks hook_block_info(), hook_block_view(), hook_menu(), hook_permission(), and now we can programmatically create as many pages and blocks as we need. In this lesson, we’ll explore the Drupal 7 Form API for creating forms. We'll build a form for administering module functionality and try to use as many of the hooks we've already learned to solidify our skills.

To start, we will display 3 blocks. I believe this won’t be difficult for you.