@drupal-js-sdk/menu
Overview
Fetches Drupal menu linkset and returns a normalized tree suitable for rendering. Also exposes helpers for validation and transformation.
Usage
JavaScript
import { Drupal } from "@drupal-js-sdk/core";
import { DrupalMenu } from "@drupal-js-sdk/menu";
const drupal = new Drupal({ baseURL: "https://example.com" });
const menu = new DrupalMenu(drupal);
const items = await menu.getMenu("main");
Public API
class DrupalMenu
Constructor
getMenu
getMenuRaw
normalizeListItems
convertFlatListItemsToTree
checkIfDrupalMenuDataIsValid
Notes
- Uses the HTTP client from
CoreInterface
and returns a normalized tree.