designtopack/public/kirby/config/sections/mixins/max.php

29 lines
439 B
PHP
Raw Normal View History

2024-07-10 16:10:33 +02:00
<?php
return [
'props' => [
/**
* Sets the maximum number of allowed entries in the section
*/
2025-02-07 17:11:37 +01:00
'max' => function (int|null $max = null) {
2024-07-10 16:10:33 +02:00
return $max;
}
],
'methods' => [
'isFull' => function () {
if ($this->max) {
return $this->total >= $this->max;
}
return false;
},
'validateMax' => function () {
if ($this->max && $this->total > $this->max) {
return false;
}
return true;
}
]
];