Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -1,6 +1,7 @@
<?php
use Kirby\Cms\File;
use Kirby\Cms\Files;
use Kirby\Toolkit\I18n;
return [
@@ -18,6 +19,12 @@ return [
'sort'
],
'props' => [
/**
* Filters pages by a query. Sorting will be disabled
*/
'query' => function (string|null $query = null) {
return $query;
},
/**
* Filters all files by template and also sets the template, which will be used for all uploads
*/
@@ -49,10 +56,17 @@ return [
return $this->parentModel();
},
'files' => function () {
$files = $this->parent->files()->template($this->template);
if ($this->query !== null) {
$files = $this->parent->query($this->query, Files::class) ?? new Files([]);
} else {
$files = $this->parent->files();
}
// filter out all protected files
$files = $files->filter('isReadable', true);
// filter files by template
$files = $files->template($this->template);
// filter out all protected and hidden files
$files = $files->filter('isListable', true);
// search
if ($this->search === true && empty($this->searchterm()) === false) {