@drupal/decoupled-menu-parser

1.0.0 • Public • Published

Decoupled Menu Parser

Index

  • Introduction
  • Requirements
  • Installation
  • Usage
  • Development
  • Maintainers

Introduction

A JavaScript library for parsing menus served by Drupal's menu linkset endpoint. See the decoupled menus documentation for more information about this endpoint.

NOTE: Currently the linkset functionality from the decoupled menus contributed module is being ported to Drupal Core. Please check this issue on Drupal.org to know more about the current status.

Requirements

This project has no other node package as a peer dependency.

Installation

Install the package via npm:

$ npm i @drupal/decoupled-menu-parser

Usage

import { denormalize, MenuInterface, NormalizedMenuInterface } from '@drupal/decoupled-menu-parser';

denormalize

Denormalizes a set of links into an instance of a Menu.

Params Type Description
normalized NormalizedMenuInterface The parsed menu data as recieved from drupal
menuID (optional) string The menu identifier in drupal

E.g. usage

import { denormalize, MenuInterface, NormalizedMenuInterface } from '@drupal/decoupled-menu-parser';

mainMenu = a_custom_method_that_fetch_data_from_drupal();
// Where mainMenu is the data returned from Drupal.
const menus = denormalize(JSON.parse(mainMenu);

Development

Development of this project is currently happening in Drupal.org

Maintainers

Current maintainers:

Readme

Keywords

none

Package Sidebar

Install

npm i @drupal/decoupled-menu-parser

Weekly Downloads

19

Version

1.0.0

License

GPL-2.0-or-later

Unpacked Size

1.1 MB

Total Files

20

Last publish

Collaborators

  • mixologic
  • justafish
  • drupalengineering