Upgrade to 3.3.0

This commit is contained in:
Bastian Allgeier
2019-11-05 09:35:58 +01:00
parent 447a9dd266
commit a431716732
186 changed files with 3068 additions and 1458 deletions

View File

@@ -15,6 +15,12 @@ return [
'parent',
],
'props' => [
/**
* Enables/disables reverse sorting
*/
'flip' => function (bool $flip = false) {
return $flip;
},
/**
* Image options to control the source and look of file previews
*/
@@ -83,6 +89,11 @@ return [
$files = $files->sortBy('sort', 'asc', 'filename', 'asc');
}
// flip
if ($this->flip === true) {
$files = $files->flip();
}
// apply the default pagination
$files = $files->paginate([
'page' => $this->page,
@@ -168,6 +179,10 @@ return [
return false;
}
if ($this->flip === true) {
return false;
}
return true;
},
'upload' => function () {

View File

@@ -19,7 +19,6 @@ return [
if ($this->text) {
$text = $this->model()->toString($this->text);
$text = $this->kirby()->kirbytext($text);
return $text;
}
},

View File

@@ -14,7 +14,9 @@ return [
'computed' => [
'help' => function () {
if ($this->help) {
return $this->model()->toString($this->help);
$help = $this->model()->toString($this->help);
$help = $this->kirby()->kirbytext($help);
return $help;
}
}
]

View File

@@ -14,7 +14,7 @@ return [
* Sets the default page for the pagination. This will overwrite default pagination.
*/
'page' => function (int $page = null) {
return get('page', $page ?? 1);
return get('page', $page);
},
],
'methods' => [

View File

@@ -20,7 +20,13 @@ return [
* Optional array of templates that should only be allowed to add.
*/
'create' => function ($add = null) {
return A::wrap($add);
return $add;
},
/**
* Enables/disables reverse sorting
*/
'flip' => function (bool $flip = false) {
return $flip;
},
/**
* Image options to control the source and look of page previews
@@ -122,6 +128,11 @@ return [
$pages = $pages->sortBy(...$pages::sortArgs($this->sortBy));
}
// flip
if ($this->flip === true) {
$pages = $pages->flip();
}
// pagination
$pages = $pages->paginate([
'page' => $this->page,
@@ -188,6 +199,10 @@ return [
];
},
'add' => function () {
if ($this->create === false) {
return false;
}
if (in_array($this->status, ['draft', 'all']) === false) {
return false;
}
@@ -222,13 +237,17 @@ return [
return false;
}
if ($this->flip === true) {
return false;
}
return true;
}
],
'methods' => [
'blueprints' => function () {
$blueprints = [];
$templates = empty($this->create) === false ? $this->create : $this->templates;
$templates = empty($this->create) === false ? A::wrap($this->create) : $this->templates;
if (empty($templates) === true) {
$templates = $this->kirby()->blueprints();