[4.x] Add option to link entries by slug #8877
Closed
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.
This PR enables linking by slug in the entries fieldtype, making it possible to use collections in a similar way to taxonomies, i.e. your YAML can look like:
instead of:
The benefit of this is you can use a hierarchical approach.
As collections can be mounted we already have free routing.
If you want to output terms (the equivalent of the taxonomy
index
page), you can then simply loop over the collection entries using a regular collection tag.If you want to output entries linked by a slug (the equivalent of the terms
show
page), you can get them as follows:To facilitate this you'll see I've added new query conditions (
includes
,doesnt_include
) which allow you to compare haystack arrays to needle strings (or arrays). This should probably replace #8357Left this as a draft to get your initial thoughts @jasonvarga. If you like the direction I'll add test coverage to get it ready for review.