Skip to content

Commit

Permalink
[#28] Improved subtree support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Sep 16, 2020
1 parent 817fe06 commit a625d46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}
},
"attributes":{
"bundle": "menu_link_content",
"title":"Home",
"description":"Home",
"menu_name":"main",
Expand All @@ -42,6 +43,7 @@
}
},
"attributes":{
"bundle": "menu_link_content",
"title":"Articles",
"description":"Articles",
"menu_name":"main",
Expand All @@ -65,6 +67,7 @@
}
},
"attributes":{
"bundle": "menu_link_content",
"title":"Recipes",
"description":"Recipes",
"menu_name":"main",
Expand All @@ -88,6 +91,7 @@
}
},
"attributes":{
"bundle": "menu_link_content",
"title":"Child",
"description":"Child",
"menu_name":"main",
Expand Down
7 changes: 6 additions & 1 deletion src/components/DruxtMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,12 @@ export default {
if (!this.depth || position <= this.depth) {
let parent = null
if (entity) {
parent = 'menu_link_content:' + entity.id
parent = entity.id
// Ensure that the parent is prefixed correctly if we're not using the JSON:API Menu Items module.
if (typeof entity.attributes.bundle !== 'undefined') {
parent = [entity.attributes.bundle, entity.id].join(':')
}
}
const entities = this.getEntitiesByFilter(key => {
Expand Down
2 changes: 1 addition & 1 deletion src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DruxtMenu {
*/
async getMenuLinkContent(menuName) {
const resource = 'menu_link_content--menu_link_content'
const fields = ['description', 'link', 'menu_name', 'parent', 'title', 'weight']
const fields = ['bundle', 'description', 'link', 'menu_name', 'parent', 'title', 'weight']

const query = new DrupalJsonApiParams()
.addFilter('enabled', '1')
Expand Down

0 comments on commit a625d46

Please sign in to comment.