How to make a custom validator available in a form?

I tried to understand custom validators for forms.
So I thought about programming an own validator class by extending from AbstractValidator and store it in My/Package/Classes/Validators.

But how can I make this validator be available as My.Package.MyValidator in the form definition yaml file? The regular flow validators are availbe starting with “Neos.Flow:”. But I didn’t get the custom validator to work. It is not available. I defined an own preset in the settings.yaml. And then…what is missing?

Neos:
  Form:
    presets:
      mypreset:
        parentPreset: default

After many unsuccessful attempts and web searches I 'm happy that I could find a website explaining what I liked to do:
https://www.gerdemann.me/posts/2017/2-advent-a-custom-validator.html

This would really be a helpful addition to the NEOS documentation.

I afterwards just like to draw the NEOS team’s attention to the easy possibility to extend the documentation with the found information above. Therefore I just pick my last conversation partner here in the forum @bwaidelich. Maybe NEOS likes to adopt the infos.

Thank you for picking me :smiley:

Great idea to extend/improve the documentation. For the form framework it’s all in this github repository: https://github.com/neos/form/tree/master/Documentation feel free to create a corresponding Pull Request, I’m more than happy to review it!

Ok. I add it to my list of github tasks for NEOS.
Just for my understanding, the linked documentation (and ervey extension) stays a closed part of this code source and will not be directly readable/searchable under the official NEOS documenation (docs.neos.io)?

1 Like

For now that’s true. It used to be linked from https://www.neos.io/docs-and-support.html at least, but that link was removed apparently…

In the long run it should be migrated, but we lack the resources to do so currently

1 Like