Repository navigation
Conversation
Element link types (e.g. Asset, Entry, Category) could only be imported by the element's ID on the site being imported into. Each element link type the field allows can now be mapped to a node identifying the element, with the attribute or custom field to match it by (e.g. an "Imported ID" field), the same as relation fields. The element is searched for in the sources the link type allows. For assets, there's also the option to upload the asset from a mapped URL when there isn't a match, into a chosen folder. The uploaded asset's match field is set, so later imports find it. If no element is found, the link falls back to its value as a URL, when it is one and the field allows URLs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The URL was saved as an option (options.urlNode), so a Link field nested in a Matrix or CKEditor field never received it: nested fields only pass on the feed data for mapped nodes. Map it as a node (url.node) like any other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Feed Me can import a Link field's
type,valueandlabel, but when a link points to an element (an entry, asset, category, etc.) thevaluehas to be that element's ID on the destination site. When migrating content between sites, the feed only has the source site's IDs, so element links can't be imported.This PR adds per-link-type element matching to the Link field mapping, the same way Entries, Assets and Categories fields already work:
Downloads/{slug}), rendered against the element being importedLink fields inside Matrix fields are supported. The element and upload URL nodes are passed through to the Link sub-field along with its other nodes.
Example
A source site exports a link like:
Mapping:
buttonLink/typebuttonLink/labelbuttonLink/element/id, matched by Imported IDbuttonLink/element/urlDownloads/{slug}On the first import, the PDF is uploaded to
Downloads/<entry-slug>/, given Imported ID12345, and linked. On later imports, it's matched by its Imported ID and not uploaded again.Changes
src/fields/Link.php: element matching per link type, optional asset upload with a dynamic folder path, and URL fallbacksrc/templates/_includes/fields/link.html: per-link-type mapping UI (match by, upload, URL node, volume, folder path)src/web/twig/variables/FeedMeVariable.php:getLinkElementTypes()for the mapping UIsrc/fields/Matrix.php: pass a Link sub-field's element and upload URL nodes through to itTesting
Tested with a content migration of ~8,000 entries using Link fields inside nested Matrix fields:
🤖 Generated with Claude Code