Upgrade to 4.0.0
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user