Drupalize.Me: Drupal 11.1 Adds Hooks as Classes: A History, How-To, and Tutorials We’ve Updated

Drupal 11.1 Adds Hooks as Classes: A History, How-To, and Tutorials We’ve Updated

With the release of Drupal 11.1, there’s a cool new feature for developers: Hooks can now be implemented as class methods using PHP attributes instead of functions. This change is a major step forward in modernizing Drupal’s codebase. While procedural function-based hooks are still supported (and will be for some time), developers writing new code should strongly consider using the object-oriented (OOP) approach introduced in Drupal 11.1.

One of our core commitments at Drupalize.Me is ensuring that our tutorials remain accurate and relevant as Drupal evolves. So we’re working on updating all of our tutorials to take into account the new OOP approach to adding hooks in a module. We’re also aware that procedural hooks have been around for 24 years, and aren’t going to disappear overnight. You’ll see them in example code and existing documentation for a long time to come. So for now we’ll be including both approaches in our content whenever doing so makes sense.

You should plan on learning both approaches, and then using the one that makes the most sense given your specific case.

Continue reading to learn a bit about the evolution of hooks in Drupal core and how to implement hooks as classes in Drupal 11 in this latest Drupalize.Me blog post by Joe Shindelar.

joe
Fri, 01/31/2025 – 18:25

This Sculpt OS video walkthrough explains how to use Sculpt OS

We talk about the Genode project and Sculpt OS quite regularly on OSNews, but every time I’ve tried using Sculpt OS, I’ve always found it so different and so unique compared to everything else that I just couldn’t wrap my head around it. I assume this stems from nothing but my own shortcomings, because the Genode project often hammers on the fact that Sculpt OS is in daily-driver use by a lot of people within and without the project, so there must be something here just not clicking for me. Well, it seems I’m actually not the only one with difficulties getting started with Sculpt OS’ unique structure and interface, because Norman Feske, co-founder of Genode Labs, has published a lengthy, detailed, but very interesting and easy to follow screencast explaining exactly how to use Sculpt OS and its unique features and characteristics. Even though Sculpt OS has been in routine daily use for years now, many outside observers still tend to perceive it as fairly obscure because it does not follow the usual preconceptions of a consumer-oriented operating system. Extensive documentation exists, but it leaves a fairly technical impression at a cursory glance, which may scare some people away. The screencast below aims at making the system a little bit more approachable. It walks you through the steps of downloading, installing, booting the system image, navigating the administrative user interface, and interactively extending and customizing the system. The tour is wrapped up with the steps for creating your personal sculpted OS on a bootable USB stick. ↫ Norman Feske After watching this, I genuinely feel I have much better grasp of how to use Sculpt OS and just how powerful it really is, and that it’s really not as difficult to use as it may look at first glance. The next time I set some time aside for Sculpt OS, I feel I’ll have a much better grasp of what to do and how to use it properly.

Equipes tentam remover aeronaves do Rio Potomac, em Washington; Neitzke traz detalhes

Video by via Dailymotion Source As equipes de resgate que trabalham no Rio Potomac, em Washington, onde caíram o avião da American Airlines e o helicóptero militar dos Estados Unidos, após uma colisão no ar na noite de quarta-feira (29), planejam retirar os escombros das duas aeronaves do local nesta sexta-feira (31). Fabrizio Neitzke trouxe … Read more

Cuma Sohbetleri – 31 Ocak 2025

Video by via Dailymotion Source Yıllardır Kanal 7 ekranlarından izleyicisine ulaşan Cuma Sohbetleri ilgi çekici konularla evlere konuk oluyor. İslamiyet’i tüm yönleriyle yaşamak isteyenler için altın değerinde tavsiyeler veren Cuma Sohbetleri Kur’an-ı Kerim’in verdiği mesajları aktarıyor. İslamiyet’i gelecek nesillere aktarmayı hedefleyen Cuma Sohbetleri izleyicisiyle buluşmaya devam ediyor. Müslümanların rehberi Kur’an-ı Kerim’den ayetler ve Hz. Muhammed’in … Read more

M3M Sector 97 Noida | New Launch Commercial Project

Video by via Dailymotion Source Welcome to our exclusive tour of M3M Sector 97 Noida, an ultra-modern commercial project that promises to be a game-changer in the real estate sector! 🚀 In this video, we dive deep into this prestigious development, offering insights into its world-class features, strategic location, and investment potential. Whether you are … Read more