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

Entries fieldtype: filter out unpublished entries when augmenting #3544

Merged

Conversation

arthurperton
Copy link
Contributor

Fixes #2721.

@duncanmcclean
Copy link
Member

I wonder if this change could introduce a breaking change for users who expect unpublished entries to be in there?

@duncanmcclean
Copy link
Member

@arthurperton Do you know if this also fixes #3539?

@arthurperton
Copy link
Contributor Author

@arthurperton Do you know if this also fixes #3539?

No! I totally didn’t expect that after seeing the code. Did you try it out?

@arthurperton
Copy link
Contributor Author

Ah sorry I read your comment the wrong way. No this won’t solve #3539, that is a different and slightly more difficult one.
I’ll have a go at it if this one gets accepted, as I agree it is quite a change in behavior.

@arthurperton
Copy link
Contributor Author

@jasonvarga Do you consider this a breaking change or just a bug fix?

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.

Sorry for the delay.

I'd consider this a bug fix. We shouldn't be showing the published entries. I doubt many, if any, would want to see drafts on the front-end.

I think ideally, instead of augmenting to a collection of actual entries, maybe it could augment to a query builder instance. Then on the front-end you could add where clauses to it.

{{ my_entries_field status:is="draft" }}
 ...
{{ /my_entries_field }}

But that's getting complicated. We can work that out later. Could be a similar solution for #3539

@jasonvarga jasonvarga merged commit 438ab1f into statamic:3.1 May 19, 2021
@arthurperton
Copy link
Contributor Author

Good! I'll look into #3539 again now that I know your stand on this 👍🏻

@mikemartin
Copy link

Hey guys,
This seems to have been a breaking change.

I have an entries fieldtype with published and unpublished entries, and augmentation now removes the unpublished entries. There seems to be no possible way to include them at the moment. I've rolled back to 3.1.14 in the meantime but hoping the above "status" solution gets implemented soon.

@helloDanuk
Copy link
Contributor

I do have a similar case as @mikemartin described. On one page I loop through all entries and only the published should be showed. So far so good.

On an another page I have an entries fieldtype (published and unpublished entries), and I would like to show the name/title of the entries, but only the published ones should have a link.

The way I see it, I can currently only create this with an additional toggle field or similar?
This also seems logical to me, but introduces an additional complexity. Two toggle fields: Published/Unpublished and shown/unshowed.

@helloDanuk
Copy link
Contributor

Bildschirmfoto 2021-06-23 um 10 47 08

In addition, the collection overview does not show whether an unpublished entry is attached in the entry field type. In this example "Test 2" also have an entry attached, but it is an unpublished one.

I probably tried this solution, because on the entry field type there is no hint, if the entry is published or not. Therefore, I thought that I could use the data under all conditions.

Bildschirmfoto 2021-06-23 um 10 57 52

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.

Entries field shows unpublished items in frontend
5 participants