* * This file is part of Kirby Blog. * * Kirby Blog is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. * * Kirby Blog is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with Kirby Blog. If not, see . */ return function ($page) { $posts = new Pages(); if ($user = kirby()->user() and $user->role()->isAdmin()) { $posts = $page->childrenAndDrafts(); } else { $posts = $page->children(); } if (kirby()->plugin("hobbyhome/permissions")) { $posts = $posts->filterBy("hasPerm", true); } $posts = $posts->sortBy("pinned", SORT_DESC, "updated", SORT_DESC); $posts = $posts->paginate($page->postsPerPage()->toInt()); return compact("posts"); };