Skip to content
Corex

NavigationServiceProvider

Corex\Theme\NavigationServiceProvider · class · Core layer

Registers the M3 navigation/footer presentation surface (Spec 058): - the corex block-pattern category, so site owners can find CoreX header/footer variants in the inserter (the variant patterns themselves are auto-registered by WordPress from theme/patterns/*.php for block themes — no PHP per pattern); and - the corex-navigation stylesheet, attached to the core navigation block via {@see wp_enqueue_block_style()} so it loads only where a navigation renders (constitution Principle VI) and never as a global library. The provider holds no business logic, no routes, and no DB access; the markup and styles live in the theme (Principle I). It registers on init, independent of any theme being active, and no-ops cleanly when the CoreX theme (which owns the asset) is not present.

maybeEnqueueNavigationScript(string $content, array $block): string

Section titled “maybeEnqueueNavigationScript(string $content, array $block): string”

Enqueue the navigation behavior script only on requests that actually render a CoreX header navigation or mega-menu (Principle VI), never globally. The markup stays fully usable without it (core navigation + native

fallbacks).