sylvainjule / kirby-pagetable

Display subpages in a flexible table section. Kirby 3 only.
MIT License
113 stars 11 forks source link

Query Outdated #88

Closed campiGit closed 8 months ago

campiGit commented 1 year ago

When i wanted to use your (btw awesome) plugin, i realised that the query your are using is outdated. I tried to query but it didnt work, until i stumbled across a kirby update which uses new Queries with a slightly different syntax.

For everybody having this problem:

  1. Go into site/plugins/pagetable/lib/pagetable.php
  2. Scroll down to line 92, which should be the else part of the if/else from the "pages" key in the "computed Array"
  3. you should see that code:
else {
    // added to support query
    $q = new Query($this->query, [
        'site' => site(),
        'page' => $this->model(),
        'pages' => site()->pages(),
        'kirby' => kirby()
    ]);
    $pages = $q->result();
}

4. Replace it with that one:

else {
    // added to support query
    $q = new Query($this->query);
    $pages = $q->resolve([
        'site' => site(),
        'page' => $this->model(),
        'pages' => site()->pages(),
        'kirby' => kirby()
    ]);
}
  1. Then scroll up to line 3 and change the import class from use Kirby\Toolkit\Query; to use Kirby\Query\Query;
  2. Should be working now :)

Would be nice to see it implemented soon, but as said: Your Plugin is sick and helps a lot!

getflourish commented 8 months ago

@campiGit Thank you so much! Works!

Vincenius commented 8 months ago

Fixed it for me as well - Thanks!

sylvainjule commented 8 months ago

I have released 1.1.7 which merges the PR, thank you!

As mentioned in #90, since the query option has been added to the native pages section in K4, I won't support the plugin going forward in favor of the core layout: table.