I have two entry types that I want to show in a sorted list (by postDate, with paginating).
{
entries(
type: ["entryType1", "entryType2"],
orderBy: "postDate desc",
limit: 5,
offset: 0
) {
id
title
postDate
typeHandle
}
}
This already works. Now the second post type entryType2
should have an optional Lightswitch showInList
, where the editor can decide if the entry should appear in the list.
{
entries(
type: ["entryType1", "entryType2"],
orderBy: "postDate desc",
showInList: 1,
limit: 5,
offset: 0
) {
id
title
postDate
typeHandle
}
}
Unfortunately with the adapted querying I only get the entries of the type with the Lightswitch field declared. When setting showInList: null
I get all entries of both entry types, but its ignoring if showInList
is true/false for any entry of the second post type.
I tested different QueryArguments but its seems they all have no effect.
Every QueryArgument is handled as if true
Tested:
showInList: 1
→ shows only entries ofentryType2
with showInList set totrue
, ignoresentryType2
showInList: ['not 1']
→ I thought this would give all entries ofentryType2
withshowInList
set to false but it behaves the same asshowInList: 1
showInList: null
→ shows entries of both types but ignores theshowInList
field
is there something like showInList: ['1 or undefined']
or any other QueryArgument
that would give me the expected result?
Tested in CraftCMS 3.4.17.1 with full schema