Upgrade to 3.2.1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\Exception;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
/**
|
||||
@@ -79,6 +81,49 @@ return [
|
||||
return '';
|
||||
},
|
||||
'validations' => [
|
||||
'date'
|
||||
'date',
|
||||
'minMax' => function ($value) {
|
||||
$min = $this->min ? strtotime($this->min) : null;
|
||||
$max = $this->max ? strtotime($this->max) : null;
|
||||
$value = strtotime($this->value());
|
||||
$format = 'd.m.Y';
|
||||
$errors = [];
|
||||
|
||||
if ($value && $min && $value < $min) {
|
||||
$errors['min'] = $min;
|
||||
}
|
||||
|
||||
if ($value && $max && $value > $max) {
|
||||
$errors['max'] = $max;
|
||||
}
|
||||
|
||||
if (empty($errors) === false) {
|
||||
if ($min && $max) {
|
||||
throw new Exception([
|
||||
'key' => 'validation.date.between',
|
||||
'data' => [
|
||||
'min' => date($format, $min),
|
||||
'max' => date($format, $max)
|
||||
]
|
||||
]);
|
||||
} elseif ($min) {
|
||||
throw new Exception([
|
||||
'key' => 'validation.date.after',
|
||||
'data' => [
|
||||
'date' => date($format, $min),
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
throw new Exception([
|
||||
'key' => 'validation.date.before',
|
||||
'data' => [
|
||||
'date' => date($format, $max),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
]
|
||||
];
|
||||
|
@@ -13,8 +13,8 @@ return [
|
||||
/**
|
||||
* Image settings for each item
|
||||
*/
|
||||
'image' => function (array $image = null) {
|
||||
return $image ?? [];
|
||||
'image' => function ($image = null) {
|
||||
return $image;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ return [
|
||||
/**
|
||||
* Main text for each item
|
||||
*/
|
||||
'text' => function (string $text = '{{ file.filename }}') {
|
||||
'text' => function (string $text = null) {
|
||||
return $text;
|
||||
},
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Cms\Api;
|
||||
use Kirby\Cms\File;
|
||||
|
||||
return [
|
||||
'props' => [
|
||||
@@ -13,13 +14,26 @@ return [
|
||||
}
|
||||
|
||||
if (is_string($uploads) === true) {
|
||||
return ['template' => $uploads];
|
||||
$uploads = ['template' => $uploads];
|
||||
}
|
||||
|
||||
if (is_array($uploads) === false) {
|
||||
$uploads = [];
|
||||
}
|
||||
|
||||
$template = $uploads['template'] ?? null;
|
||||
|
||||
if ($template) {
|
||||
$file = new File([
|
||||
'filename' => 'tmp',
|
||||
'template' => $template
|
||||
]);
|
||||
|
||||
$uploads['accept'] = $file->blueprint()->accept()['mime'] ?? '*';
|
||||
} else {
|
||||
$uploads['accept'] = '*';
|
||||
}
|
||||
|
||||
return $uploads;
|
||||
},
|
||||
],
|
||||
|
@@ -22,20 +22,6 @@ return [
|
||||
return $this->toPages($default);
|
||||
},
|
||||
|
||||
/**
|
||||
* Image settings for each item
|
||||
*/
|
||||
'image' => function (array $image = null) {
|
||||
return $image ?? [];
|
||||
},
|
||||
|
||||
/**
|
||||
* Info text for each item
|
||||
*/
|
||||
'info' => function (string $info = null) {
|
||||
return $info;
|
||||
},
|
||||
|
||||
/**
|
||||
* Changes the layout of the selected files. Available layouts: `list`, `cards`
|
||||
*/
|
||||
@@ -57,13 +43,6 @@ return [
|
||||
return $size;
|
||||
},
|
||||
|
||||
/**
|
||||
* Main text for each item
|
||||
*/
|
||||
'text' => function (string $text = null) {
|
||||
return $text;
|
||||
},
|
||||
|
||||
'value' => function ($value = null) {
|
||||
return $this->toPages($value);
|
||||
},
|
||||
|
Reference in New Issue
Block a user