O'Reilly logo

Functional PHP by Gilles Crettenand

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drupal

Drupal modules until version 7 relied on hooks to perform operations. Drupal hooks are functions following a certain naming pattern that get called by Drupal when various events occur when responding to a request to modify various aspects of the generated web page.

In an ideal world, all hooks would receive all needed information to perform their work and the way to modify something would be using the return value. This is mostly true for some parts of the module API. Sadly, there are some functions that receive parameters passed by reference, such as the hook_block_list_alter function. Also, you sometimes need to access global variables, for example, to get hold of the current language.

Drupal 8 moved to a class-based approach. The content ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required