Field Types sanitation

Hi guys,

First of all, I like Cockpit very much.

Now with the question, I realized that the only Field Types that are being sanitized are text, boolean, number, url, email and password (modules/Collections/bootstrap.php), so, is the idea behind all of this to leave it like that and keep it simple and leave the developer to be responsible of the other Field Types or is just work that needs to be done?

Thank you!

you can inject your custom validation via an event hook:

(snippet should be located in config/bootstrap.php)

$app->on('', function($name, &$entry, $isUpdate) {

    $check = true;
    // do custom validation e.g. if ($entry['name'] !== 'John') $check = false

    if (!$check) {
       $this->stop(['error' => "Validation error"], 412);

Replace MyCollection with your collection name

Thank you very much @artur, I realized that after creating the post :slight_smile: