- Issue created by @DamienMcKenna
While working on a site I changed from using Default Content's drush commands to export the entities to doing them by hand based upon examples previously created. This worked well up until I was trying to set the parent on menu_link_content entities. After some testing I finally worked out how to do it so wanted to document it here.
This is the parent item that will have child element(s) later:
_meta:
version: '1.0'
entity_type: menu_link_content
uuid: 2d0659d1-ba09-4bca-9adc-9833d484590a
bundle: main
default_langcode: en
default:
enabled:
-
value: true
title:
-
value: "The parent"
menu_name:
-
value: main
link:
-
uri: 'internal:/some/thing'
title: ''
external:
-
value: false
rediscover:
-
value: false
weight:
-
value: -10
expanded:
-
value: false
revision_translation_affected:
-
value: true
This is the child element:
_meta:
version: '1.0'
entity_type: menu_link_content
uuid: e412fa5d-1926-428d-8926-45f257d9c92e
bundle: main
default_langcode: en
depends:
2d0659d1-ba09-4bca-9adc-9833d484590a: menu_link_content
default:
enabled:
-
value: true
title:
-
value: "Child page"
menu_name:
-
value: main
link:
-
uri: 'internal:/over/there'
title: ''
external:
-
value: false
rediscover:
-
value: false
weight:
-
value: -100
expanded:
-
value: false
revision_translation_affected:
-
value: true
parent:
-
value: 'menu_link_content:2d0659d1-ba09-4bca-9adc-9833d484590a'
The important pieces of the child are:
I tried using the parent item's ID, its UUID, using "target_id" as the key, using "parent_id" as the attribute, lots of different options, but this was the correct combination in the end.
Active
2.0
Documentation