I have added a custom form validation on node/add page in drupal 8. The purpose of adding this validator is to add a slash before the path alias string. By default if a path alias string is added without a slash then form validator gives an error asking to add a slash before string.
Now the problem is that the default validation is called before the custom validator.
The code have use is like :-
In my form_alter
function
if (!is_array($form['#validate'])) {
$form['#validate'] = array();
}
array_unshift($form['#validate'], 'my_custom_handler');
to add custom validator to the top of validate
array.
Although, my custom validator is added to the top of validator array, still default validator is executing first.
Any help will be highly appreciated.
Thank you