flokosiol / kirby-subpagelist

Subpagelist field plugin for Kirby 2
MIT License
46 stars 4 forks source link

filterBy date - pages older than now #8

Open iskrisis opened 7 years ago

iskrisis commented 7 years ago

I would like to show only pages that have date older/newer than today.

  archived_events:
    label: Archived events
    type:  subpagelist
    filter:
      visible: true
      filterBy: date
      filterMethod: >
      filterValue: time()

Does not seem to do anything.

How to set filtervalue properly? And maybe i need escape filter method?

flokosiol commented 7 years ago

Thanks for reporting. Unfortunately time() does not work here, because the content of the file is parsed as yaml and not as php. I will try to find a solution for this …

To use > as filterMethod you need to use quotation marks like this …

filterMethod: '>'

Since this will also work for the other methods I will update the docs accordingly.

There's also an issue with using integers as filterValue, but I found a solution for this. I will do some more testing and then push an update as soon as possible.

iskrisis commented 7 years ago

Oh thats strange. I am so sure i saw the usage of it somewhere like this. Although its very unusual in kirby world it is used like this with grav cms. Maybe thats why i got it mixed.

The question is - is it kirbys limitation - it just spits out strings which are imposible to execute? I dont know enough about kirbys insides but this would be highly useful to me so i guess its time to fork and try.

Thx! 👍