API Documentation

DruxtMenu

menu

Modules

DruxtMenu

Renders a Drupal menu using either the default Drupal content menus, or the full menu via the JSON:API Menu Items module.

Typedefs

ComponentOptions : Array.<array>

Provides the available naming options for the Wrapper component.

ModuleSettings : object

Provides settings for the Menu module, via the nuxt.config.js druxt.menu or the Wrapper component druxt object.

PropsData : object

Provides propsData for use in the Wrapper component.

ScopedSlots : object

Provides scoped slots for use in the Wrapper component.

DruxtMenu

Renders a Drupal menu using either the default Drupal content menus, or the full menu via the JSON:API Menu Items module.

Example

<DruxtMenu name="main" />

.getMenuItems([entity], [position])

Recursively gets required menu items from the Vuex store.

Kind: instance method of DruxtMenu

ParamTypeDescription
[entity]objectCurrent menu item entity.
[position]integerCurrent position in the menu tree,

.props

Kind: static property of DruxtMenu


.depth : integer

The depth of the menu items to render.

Kind: static property of props
Default: 0
Example

<DruxtMenu :depth="1" />

.itemClass : string

Class(es) to apply to the menu items.

Kind: static property of props


.itemComponent : string

Component or element to render the menu items.

Kind: static property of props
Default: "li"


.maxDepth : integer

The maximum depth of the menu tree data to load.

Kind: static property of props
Example

<DruxtMenu :max-depth="4" />

.minDepth : Integer

The minimum depth of the menu tree.

Kind: static property of props
Default: 0
Example

<DruxtMenu :min-depth="2" />

.name : string

The name of the menu to load and render.

Kind: static property of props
Default: "main"
Example

<DruxtMenu name="main" />

.parentId : string

The menu parent ID to use as the root of the menu.

Kind: static property of props
Example

<DruxtMenu parent-id="views_view:views.recipes.page_1" />

.parentClass : string

Class(es) to apply to parent menu items.

Kind: static property of props


.parentComponent : string

Component or element to render parent menu items.

Kind: static property of props
Default: "li"


.parentWrapperClass : string

Class(es) to apply to a wrapper around parent menu items.

Kind: static property of props


.parentWrapperComponent : string

Component or element to render a wrapper around parent menu items.

Kind: static property of props
Default: "ul"


.computed

Kind: static property of DruxtMenu


.items : Array.<objects>

Deprecated

The processed Menu items.

Kind: static property of computed


.trail : Array.<string>

The active route trail.

Kind: static property of computed


.watch

Kind: static property of DruxtMenu


.entities()

Updates menu when available Entities change.

Kind: static method of watch


.druxt

DruxtModule settings.

Kind: static property of DruxtMenu


.componentOptions(context) ⇒ ComponentOptions

Provides the available component naming options for the Druxt Wrapper.

Kind: static method of druxt

ParamTypeDescription
contextobjectThe module component ViewModel.

.propsData(context) ⇒ PropsData

Provides propsData for the DruxtWrapper.

Kind: static method of druxt

ParamTypeDescription
contextobjectThe module component ViewModel.

.slots() ⇒ ScopedSlots

Provides the scoped slots object for the Module render function.

Adds a default slot that will render the menu tree using the DruxtMenuItem component.

Kind: static method of druxt
Returns: ScopedSlots - The Scoped slots object.
Example (DruxtMenuName.vue)

<template>
  <div>
    <slot />
  </div>
</template>

.fetch()

Nuxt.js fetch method.

Builds and executes the JSON:API query, loading the menu items into the druxtMenu Vuex store.

Kind: static method of DruxtMenu


ComponentOptions : Array.<array>

Provides the available naming options for the Wrapper component.

Kind: global typedef
Example

[
  'DruxtMenu[Name]',
  'DruxtMenuDefault',
]

Example (Main menu (default))

[
  'DruxtMenuMain',
  'DruxtMenuDefault',
]

ModuleSettings : object

Provides settings for the Menu module, via the nuxt.config.js druxt.menu or the Wrapper component druxt object.

Kind: global typedef

ParamTypeDescription
fieldsArray.<string>An array of fields to filter all JSON:API Menu queries.
requiredOnlybooleanWhether to automatically filter to module defined minimum required fields.

Example

{
  fields: [],
  requiredOnly: true,
}

Example

<script>
export default {
  druxt: {
    query: {
      fields: ['description', 'options']
      requiredOnly: false,
    },
  }
}

PropsData : object

Provides propsData for use in the Wrapper component.

Kind: global typedef

ParamTypeDescription
itemsArray.<object>The Menu items structured data.
valueArray.<object>The Menu items structured data.

Example

{
  items: [
    {
      children: [],
      entity: {},
    },
  ],
  value: [
    {
      children: [],
      entity: {},
    },
  ],
}

ScopedSlots : object

Provides scoped slots for use in the Wrapper component.

Kind: global typedef

ParamTypeDescription
defaultfunctionAll menu items using the DruxtMenuItem component

Example (DruxtMenuName.vue)

<template>
  <div>
    <slot />
  </div>
</template>