diff --git a/apps/cms/config/sync/system.menu.meta.yml b/apps/cms/config/sync/system.menu.meta.yml new file mode 100644 index 000000000..ef60f59a2 --- /dev/null +++ b/apps/cms/config/sync/system.menu.meta.yml @@ -0,0 +1,8 @@ +uuid: ed03f628-2d83-4f82-aeb8-6c59d150757d +langcode: en +status: true +dependencies: { } +id: meta +label: Meta +description: 'Meta links.' +locked: false diff --git a/packages/drupal/test_content/content/menu_link_content/4aa4a86f-8e0f-441d-8fcb-ac95b15ed13c.yml b/packages/drupal/test_content/content/menu_link_content/4aa4a86f-8e0f-441d-8fcb-ac95b15ed13c.yml new file mode 100644 index 000000000..430e6e5b4 --- /dev/null +++ b/packages/drupal/test_content/content/menu_link_content/4aa4a86f-8e0f-441d-8fcb-ac95b15ed13c.yml @@ -0,0 +1,68 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 4aa4a86f-8e0f-441d-8fcb-ac95b15ed13c + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Meta item 2' + menu_name: + - + value: meta + link: + - + uri: 'internal:/' + title: '' + options: { } + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -49 + expanded: + - + value: false + content_translation_source: + - + value: und + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716899458 +translations: + de: + title: + - + value: 'Meta item 2 DE' + content_translation_source: + - + value: en + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716900493 diff --git a/packages/drupal/test_content/content/menu_link_content/679de789-7c88-494e-866d-062c2abf8fbb.yml b/packages/drupal/test_content/content/menu_link_content/679de789-7c88-494e-866d-062c2abf8fbb.yml new file mode 100644 index 000000000..5c8065b71 --- /dev/null +++ b/packages/drupal/test_content/content/menu_link_content/679de789-7c88-494e-866d-062c2abf8fbb.yml @@ -0,0 +1,68 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 679de789-7c88-494e-866d-062c2abf8fbb + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Meta item 1' + menu_name: + - + value: meta + link: + - + uri: 'internal:/' + title: '' + options: { } + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -50 + expanded: + - + value: false + content_translation_source: + - + value: und + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716899070 +translations: + de: + title: + - + value: 'Meta item 1 DE' + content_translation_source: + - + value: en + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716900444 diff --git a/packages/drupal/test_content/content/menu_link_content/72904161-a94f-4934-98aa-f4b67e2dc9d5.yml b/packages/drupal/test_content/content/menu_link_content/72904161-a94f-4934-98aa-f4b67e2dc9d5.yml new file mode 100644 index 000000000..34c48f445 --- /dev/null +++ b/packages/drupal/test_content/content/menu_link_content/72904161-a94f-4934-98aa-f4b67e2dc9d5.yml @@ -0,0 +1,73 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 72904161-a94f-4934-98aa-f4b67e2dc9d5 + bundle: menu_link_content + default_langcode: en + depends: + 679de789-7c88-494e-866d-062c2abf8fbb: menu_link_content +default: + enabled: + - + value: true + title: + - + value: 'Meta item child - should be ignored' + menu_name: + - + value: meta + link: + - + uri: 'internal:/' + title: '' + options: { } + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -50 + expanded: + - + value: false + parent: + - + value: 'menu_link_content:679de789-7c88-494e-866d-062c2abf8fbb' + content_translation_source: + - + value: und + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716899647 +translations: + de: + title: + - + value: 'Meta item child - should be ignored DE' + content_translation_source: + - + value: en + content_translation_outdated: + - + value: false + content_translation_uid: + - + target_id: 1 + content_translation_status: + - + value: true + content_translation_created: + - + value: 1716900507 diff --git a/packages/schema/src/operations/Frame.gql b/packages/schema/src/operations/Frame.gql index 71e0dca6f..fe939e41b 100644 --- a/packages/schema/src/operations/Frame.gql +++ b/packages/schema/src/operations/Frame.gql @@ -7,6 +7,9 @@ query Frame { } } } + metaNavigation: metaNavigations { + ...Navigation + } mainNavigation: mainNavigations { ...Navigation } diff --git a/packages/schema/src/schema.graphql b/packages/schema/src/schema.graphql index fbeafa4e3..7d32ba803 100644 --- a/packages/schema/src/schema.graphql +++ b/packages/schema/src/schema.graphql @@ -118,6 +118,11 @@ interface Navigation { items: [NavigationItem]! } +type MetaNavigation implements Navigation @menu(menu_id: "meta") { + locale: Locale! @resolveEntityLanguage + items: [NavigationItem]! @lang @resolveMenuItems(max_level: 1) +} + type MainNavigation implements Navigation @menu(menu_id: "main") { locale: Locale! @resolveEntityLanguage items: [NavigationItem]! @lang @resolveMenuItems @@ -309,6 +314,10 @@ type Query { previewDrupalPage(id: ID!, rid: ID, locale: String!): DrupalPage @fetchEntity(type: "node", id: "$id", rid: "$rid", language: "$locale") + metaNavigations: [MetaNavigation] + @gatsbyNodes(type: "MetaNavigation") + @menuTranslations(menu_id: "meta") + mainNavigations: [MainNavigation] @gatsbyNodes(type: "MainNavigation") @menuTranslations(menu_id: "main") diff --git a/tests/schema/specs/menu.spec.ts b/tests/schema/specs/menu.spec.ts new file mode 100644 index 000000000..54e7757f0 --- /dev/null +++ b/tests/schema/specs/menu.spec.ts @@ -0,0 +1,52 @@ +import gql from 'noop-tag'; +import { expect, test } from 'vitest'; + +import { fetch } from '../lib.js'; + +test('Meta', async () => { + const result = await fetch(gql` + { + metaNavigations { + locale + items { + title + target + } + } + } + `); + expect(result).toMatchInlineSnapshot(` + { + "data": { + "metaNavigations": [ + { + "items": [ + { + "target": "/en", + "title": "Meta item 1", + }, + { + "target": "/en", + "title": "Meta item 2", + }, + ], + "locale": "en", + }, + { + "items": [ + { + "target": "/de", + "title": "Meta item 1 DE", + }, + { + "target": "/de", + "title": "Meta item 2 DE", + }, + ], + "locale": "de", + }, + ], + }, + } + `); +});