I'm creating a new field in Drupal 8. I've created a class for the widget, extending WidgetBase
and implementing WidgetInterface
, and added the functions defaultSettings()
, settingsForm()
and settingsSummary()
.
I want/need to validate the element I'm adding in settingsForm()
, but I can't seem to figure out how to add validation to this. I tried adding a function settingsFormValidate()
, but that doesn't seem to be called. I also tried adding #element_validate
to the element I'm adding in settingsForm()
, but that also does not seem to be called.
Note that I'm not looking to validate the widget (that is shown to the user), I'm looking to validate the element added in settingsForm()
for the widget, that is on the Manage Form Display tab, when adding the field to Entities/content types.
Does anyone know how or whether it's even possible to add validation to the widget settings form?