no page_alter
✓ Published0🌍 Public
Aalexfinnarn
Last edited Aug 9, 2018
Created on Aug 9, 2018
This example shows a Backdrop CMS module hook that conditionally loads JavaScript and CSS assets for code syntax highlighting on specific node types. It uses `hook_page_alter()` to check the current node’s type against configured enabled types, then calls `backdrop_add_css()` and `backdrop_add_js()` to include the Highlight.js library, a theme stylesheet, and a custom inline script that triggers `hljs.initHighlightingOnLoad()`. The rendering approach relies on server-side PHP logic rather than a client-side visualization library, with asset paths derived from `backdrop_get_path()`.
AI-generated description