SettingControlBase.validate?
SettingControlBase › validate?
Official
Type: (value: V) => string | void | Promise<string | void>
Validate a candidate value before it is persisted. Return a non-empty string to reject the change and surface it as an inline error message below the setting; return void/empty/undefined to accept and persist.Primarily intended for text-bearing controls (
text, textarea, number, file, folder) where the user can enter values the bind's type alone can't constrain.The stored value may already be invalid when the setting is rendered (e.g. data from a previous version of your plugin). The framework runs
validate once on mount and shows the message if the seeded value fails; it does not modify or replace the stored value. Plugins that need to enforce invariants on stored data should validate again when reading their settings. Since: 1.13.0