What are Preprocess Hooks?


Preprocess hooks are PHP functions that allow developers to alter theme variables before they’re used in templates.

Examples


Example 2a - simple alter

Example 2b - simple alter, alternate

Example 2c - simple addition

Example 2d - conditional addition

References and further reading