Closed timbertens closed 3 years ago
Are you using the latest version of Craft and Migration Assistant? Also, please confirm that the entry with slug 'contacteer' in section 'contact' exists. Tested locally in Matrix blocks with Entry links and it is working correctly.
yes, using
yes, see screenshot. Don't know if that would make difference, but it is a 'Single'
Tested with asset, single entry and section entry locally, all worked correctly. On the destination site the 'contact' entry exists and is enabled for the 'default' site?
First of all, thanks for the search. Looking further into this, I can see a non-intended difference
source site
destination site
It appears that in https://github.com/craftcms/cms/issues/3368 the option was added to CraftCMS 3.2 to specify a slug on a single, this did not exist before and the slugs for singles were always the same in both source and destination sites.
Even stranger is that as far as I can see, this added functionality does not actually have an effect on the slug used, the one set in the section config still applies, but I guess this is what makes MigrationAssistant fail to insert the 'Contact' page in that LinkField as the slugs are used as key and they are different.
Ah, yes I do recall we had to make a slight tweak because of that change in Craft to make sure we got the entry slug on singles. Glad you sorted it out.
The import of LinkField migration is no longer working correctly, not sure since what version exactly but in the previous versions it definitely worked as expected. This is the json string that is created upon creating a migration
private $json = <<<'JSON' {"content":{"entries":[{"slug":"test","section":"nieuwsItems","sites":{"default":{"slug":"test","section":"nieuwsItems","enabled":true,"site":"default","enabledForSite":true,"postDate":{"date":"2021-05-05 09:45:00.000000","timezone_type":3,"timezone":"Europe/Brussels"},"expiryDate":null,"title":"Test","entryType":"nieuws","uid":"389d6d37-6c91-43da-8862-5d99a094d5d9","author":"admin","fields":{"nieuwsIcoon":[],"introTekst":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.","contentBuilder":{"new1":{"type":"tekst","enabled":true,"sortOrder":"1","fields":{"tekst":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec ullamcorper nulla non metus auctor fringilla. Donec sed odio dui. Maecenas faucibus mollis interdum.</p>"}},"new2":{"type":"ctaButton","enabled":true,"sortOrder":"2","fields":{"button":{"ariaLabel":null,"customQuery":null,"customText":"","target":"","title":null,"type":"entry","value":[{"elementType":"craft\\elements\\Entry","slug":"contacteer","section":"contact","site":"default"}],"elementType":"typedlinkfield\\fields\\LinkField"}}}},"keywords":null,"metaDescription":null,"seoImage":[],"importId":null}},"kbcAgentFrans":{"slug":"test","section":"nieuwsItems","enabled":true,"site":"kbcAgentFrans","enabledForSite":true,"postDate":{"date":"2021-05-05 09:45:00.000000","timezone_type":3,"timezone":"Europe/Brussels"},"expiryDate":null,"title":"Test","entryType":"nieuws","uid":"389d6d37-6c91-43da-8862-5d99a094d5d9","author":"admin","fields":{"nieuwsIcoon":[],"introTekst":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.","contentBuilder":{"new1":{"type":"tekst","enabled":true,"sortOrder":"1","fields":{"tekst":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec ullamcorper nulla non metus auctor fringilla. Donec sed odio dui. Maecenas faucibus mollis interdum.</p>"}},"new2":{"type":"ctaButton","enabled":true,"sortOrder":"2","fields":{"button":{"ariaLabel":null,"customQuery":null,"customText":"","target":"","title":null,"type":"entry","value":[{"elementType":"craft\\elements\\Entry","slug":"contacteer","section":"contact","site":"default"}],"elementType":"typedlinkfield\\fields\\LinkField"}}}},"keywords":null,"metaDescription":null,"seoImage":[],"importId":null}},"kbcAgentEngels":{"slug":"test","section":"nieuwsItems","enabled":true,"site":"kbcAgentEngels","enabledForSite":true,"postDate":{"date":"2021-05-05 09:45:00.000000","timezone_type":3,"timezone":"Europe/Brussels"},"expiryDate":null,"title":"Test","entryType":"nieuws","uid":"389d6d37-6c91-43da-8862-5d99a094d5d9","author":"admin","fields":{"nieuwsIcoon":[],"introTekst":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.","contentBuilder":{"new1":{"type":"tekst","enabled":true,"sortOrder":"1","fields":{"tekst":"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec ullamcorper nulla non metus auctor fringilla. Donec sed odio dui. Maecenas faucibus mollis interdum.</p>"}},"new2":{"type":"ctaButton","enabled":true,"sortOrder":"2","fields":{"button":{"ariaLabel":null,"customQuery":null,"customText":"","target":"","title":null,"type":"entry","value":[{"elementType":"craft\\elements\\Entry","slug":"contacteer","section":"contact","site":"default"}],"elementType":"typedlinkfield\\fields\\LinkField"}}}},"keywords":null,"metaDescription":null,"seoImage":[],"importId":null}}}}]}} JSON;
When you look at the specific part of the LinkField, all info looks correct and complete
"new2":{"type":"ctaButton","enabled":true,"sortOrder":"2","fields":{"button":{"ariaLabel":null,"customQuery":null,"customText":"","target":"","title":null,"type":"entry","value":[{"elementType":"craft\\elements\\Entry","slug":"contacteer","section":"contact","site":"default"}],"elementType":"typedlinkfield\\fields\\LinkField"}}}}
As you can see in this example, the LinkField is supposed to link to the section 'contact' However, upon running this migration, the LinkField is not populated with that entry, but left blank
The LinkField is part of a matrix field called 'ContentBuilder'