In my old plugin Kirby Scheduled Pages I have two methods: https://github.com/jenstornell/kirby-scheduled-pages/blob/master/docs/PAGES-METHODS.md
$collection1 = $pages->scheduled()
$collection2 = $pages->unscheduled()
The first one is a collection with scheduled pages. The second one does the same thing, but the other way around. Therefor I wonder if there is a clever way to just invert the result.
This does not work by design but looks nice:
foreach(!$pages->scheduled() as $item) {
}
Instead of remember two methods, remember one.
But because isNotEmpty is a method built into the core, I guess it’s not possible?
Could you not tweak the plugin so you do this instead…
$pages->scheduled('true')
or $pages->scheduled('false')
and drop unscheduled()
from the plugin altogether. That way you are doing the hard work under the hood instead of having two methods for the user to worry about.
1 Like
Thanks!
Yes, that’s brilliant, should have thought of that.
But I will probably change it slightly.
Something like this:
$pages->scheduled()
$pages->scheduled(false)
If false
, it’s false, else it’s true
. Makes it a bit shorter. Also I use booleans instead of strings.
No worries Jens 
I love that plugin btw, I do hope it has a place in the future of Kirby 
1 Like

It will. 
In fact, that’s what I’m working on. It may be one of my first plugins for Kirby 3. I will also keep the working Kirby 2 version.
In this forum I ask questions in Kirby 2 terms, to not spoil Kirby 3
1 Like