getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.44k stars 1.39k forks source link

[Feature Request] Filter collection by page header #3074

Open NicoHood opened 3 years ago

NicoHood commented 3 years ago

Similar to the order option I want to filter a collection based on the page header. For example header.premium: true. Maybe it would make sense to add a comlete twig condition there that gets evaluated, so you can also do header.rating > 3 for example.

I know that a custom filter can be done via twig loops, but I want to first filter based on the header and then sort the collection again. This is not so trivial in twig and would make sense to have it built-in.

w00fz commented 3 years ago

I think my same comment in https://github.com/getgrav/grav/issues/3073#issuecomment-731594588 applies to this.

mahagr commented 3 years ago

Flex pages already supports this, though not through the old collections, but by using Flex directory directly (such as in admin).

Frontend legacy support for Flex Pages is still not stable enough to be used, though...

NicoHood commented 3 years ago

What do you mean by "Frontend legacy"? Frontend is the actual website? Or the Admin Edit page? What is the alternative then?

mahagr commented 3 years ago

I meant to say that the logic used in Grav to register and display pages in the web site is not fully working with Flex pages yet. I also call it "legacy" because of pages logic in the frontend (read web site) is probably the oldest part of Grav and needs to be changed to work better with the new architecture.