Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarten up conditions on Entry fields #3976

Closed
wants to merge 4 commits into from
Closed

Smarten up conditions on Entry fields #3976

wants to merge 4 commits into from

Conversation

duncanmcclean
Copy link
Member

This pull request closes #3954. The examples explain the fix (which I shamelessly stole from Jack's issue 😆 )

Examples

Before

post: 123-123-123-1234
---
{{ collection:products :post:is="post" }} // this doesn't work
{{ collection:products :post:is="post:id" }} // this does work but it's not intuitive

After

post: 123-123-123-1234
---
{{ collection:products :post:is="post" }} // NOW this works
{{ collection:products :post:is="post:id" }} // of course, this stays working

I did originally write the code to do this for terms too but I was too lazy to get everything around that setup to make sure it works. It's pretty much the same as the Entry code I added but for the Term interface. I can add it back if you want.

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind whipping up a repo that shows how it's broken before this change?

It seems to work fine when I tried. I must be missing something specific.

@duncanmcclean
Copy link
Member Author

Would you mind whipping up a repo that shows how it's broken before this change?

It seems to work fine when I tried. I must be missing something specific.

Sure, will do!

@duncanmcclean
Copy link
Member Author

Here we go - https://github.com/duncanmcclean/cms-3976

My home entry has an entries field to itself
My article entries have an entries field, two of them point to the home entry

When pulled in with this branch, the results from both examples should be the same (you can replicate when viewing the homepage)

image

@jasonvarga
Copy link
Member

Thanks for the repo and the PR. 👍

I'm going to close this PR for now though.

This PR would change the behavior of this existing behavior: d6b1d21

I agree that being able to do {{ collection:products :post:is="post" }} makes a lot of sense, but this change could potentially break things.

@jasonvarga jasonvarga closed this Aug 11, 2021
@duncanmcclean duncanmcclean deleted the fix/3954 branch August 11, 2021 21:25
@jasonvarga
Copy link
Member

Added more context here. #3954 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering a Collection by a "related entry" should be smarter
2 participants