Files
lichterei-web/kirby/config/sections/mixins/max.php
Bastian Allgeier 01277f79f2 first version
2019-01-13 23:17:34 +01:00

29 lines
587 B
PHP
Executable File

<?php
return [
'props' => [
/**
* Sets the maximum number of allowed entries in the section
*/
'max' => function (int $max = null) {
return $max;
}
],
'methods' => [
'isFull' => function () {
if ($this->max) {
return $this->total >= $this->max;
}
return false;
},
'validateMax' => function () {
if ($this->max && $this->max < $this->total) {
return false;
}
return true;
}
]
];