Showing 11 posts by,

Deji Akala

Earlier Drupal versions have a hook system, a way of letting other developers write code that interacts with core code in a clean and organized manner. System events are defined, and when they occur, the entire application is notified, and all the code associated with the event is run. The hook system is based on the naming and definition of functions. When certain events occur, e.g. a form has been built, a node is being inserted into the datab [...]

The heart of Drupal 8 is the DrupalKernel, an extension of the HttpKernel component from Symfony. The documentation beautifully summarizes its purpose: The HttpKernel component provides a structured process for converting a Request into a Response by making use of the EventDispatcher component. The HttpKernelInterface only provides a single method, handle(), which is where the seemingly magical process of converting a Request to Response takes [...]

Introduction Management of site settings has been a challenge ever since the early days of the Drupal project. What is managed as configuration is often difficult to differentiate from the content. General site information is not the same as taxonomy vocabularies, terms, menus, or blocks. Earlier versions of Drupal store a variety of settings as variables which are managed with variable_get(), variable_set() and variable_del() functions. Drupa [...]

Definition A Drupal 8 application has several objects, some of which specialize in the performance of specific tasks across the system, e.g. logging, mailing, authentication, etc. There might even be a simple object with a couple of methods to be shared by other classes. These objects are called services. Then, there is a service container which is a special object that holds or contains all the services in the application. The Symfony Dependency [...]

Usually, web applications do one thing. A browser makes a request for a resource and the server replies with a response. It is Request in, Response out. With a centralized request-handling mechanism, all requests pass through a single handler which kicks off a workflow doing things like authentication, authorization, or logging, until the resource is located and returned to the request agent, usually a web browser. This is the front controller [...]

Drupal 8 is about Object-Oriented Programming (OOP) and a firm positioning of Drupal in the enterprise. The introduction of key Symfony components was meant to herald new beginnings and enforce a more professional programming paradigm. The hook system which is as old as the project allows Drupal core to call certain functions defined in modules at specific places. In other words, Drupal allows developers to interact with core code when some thin [...]

Drupal, like other web applications, receives an HTTP request for a resource and returns a response. This is a multi-step process that involves decoding the request and mapping it to a predefined callback. When the callback function is executed, the requested resource is prepared and returned to the caller. Let us take a closer look at the way a simple page is built and displayed in both Drupal 7 and 8. Drupal 7 In a module, for example simple_ [...]

Introduction The menu system powers the navigation a user interacts with on a site. It is also responsible for how a request is directed to the right callback for a response to be generated. Drupal 7 There are two parts to the menu system in Drupal 7. Actions The menu system holds the key to understanding how Drupal handles an HTTP request received by the index.php file. It is 4 lines of code and has calls to two Drupal functions: // index.php [...]

Often, web applications and frameworks allow developers to customize and extend their functionalities. They differ in approach and nomenclature. Wordpress has plugins. In full stack Symfony, they are referred to as bundles, and in Drupal they are modules. The module system in Drupal 8 has undergone many changes. Here, we take a brief look at some of the key differences. Drupal 7 Modules, themes, and profiles are treated the same way. They must [...]

DrupalConsole is a great CLI tool for Drupal 8. As we have seen in our Introduction to DrupalConsole, it is designed for generating boilerplate code and interacting with a Drupal site. The DrupalConsole Launcher executes console commands from the terminal. A console command should be as light as possible and not attempt to do too much. This article assumes you have installed the DrupalConsole Launcher and Drupal 8. Preferably, you should have rea [...]