julienmonnerie/kirby/config/fields/range.php

34 lines
679 B
PHP
Raw Normal View History

2022-06-17 17:51:59 +02:00
<?php
2025-04-21 18:57:21 +02:00
use Kirby\Toolkit\I18n;
2022-06-17 17:51:59 +02:00
return [
2022-08-31 15:02:43 +02:00
'extends' => 'number',
'props' => [
/**
* Unset inherited props
*/
'placeholder' => null,
2022-06-17 17:51:59 +02:00
2022-08-31 15:02:43 +02:00
/**
* The maximum value on the slider
*/
'max' => function (float $max = 100) {
return $max;
},
/**
* Enables/disables the tooltip and set the before and after values
*/
'tooltip' => function ($tooltip = true) {
2025-04-21 18:57:21 +02:00
if (is_array($tooltip) === true) {
$after = $tooltip['after'] ?? null;
$before = $tooltip['before'] ?? null;
$tooltip['after'] = I18n::translate($after, $after);
$tooltip['before'] = I18n::translate($before, $before);
}
2022-08-31 15:02:43 +02:00
return $tooltip;
},
]
2022-06-17 17:51:59 +02:00
];