xiaowang/kirby/config/fields/writer.php

36 lines
1.2 KiB
PHP
Raw Normal View History

2021-10-29 18:05:46 +02:00
<?php
2021-11-18 17:44:47 +01:00
use Kirby\Sane\Sane;
2021-10-29 18:05:46 +02:00
return [
'props' => [
/**
* Enables inline mode, which will not wrap new lines in paragraphs and creates hard breaks instead.
*
* @param bool $inline
*/
'inline' => function (bool $inline = false) {
return $inline;
},
/**
2021-11-18 17:44:47 +01:00
* Sets the allowed HTML formats. Available formats: `bold`, `italic`, `underline`, `strike`, `code`, `link`, `email`. Activate them all by passing `true`. Deactivate them all by passing `false`
2021-10-29 18:05:46 +02:00
* @param array|bool $marks
*/
'marks' => function ($marks = true) {
return $marks;
},
/**
2021-11-18 17:44:47 +01:00
* Sets the allowed nodes. Available nodes: `paragraph`, `heading`, `bulletList`, `orderedList`. Activate/deactivate them all by passing `true`/`false`. Default nodes are `paragraph`, `heading`, `bulletList`, `orderedList`.
2021-10-29 18:05:46 +02:00
* @param array|bool|null $nodes
*/
'nodes' => function ($nodes = null) {
return $nodes;
}
],
'computed' => [
'value' => function () {
2021-11-18 17:44:47 +01:00
return Sane::sanitize(trim($this->value), 'html');
2021-10-29 18:05:46 +02:00
}
],
];