Search code examples
phpvalidationdrupaldrupal-hooksdrupal-blocks

How to validate hook block configure form in Drupal 7


In Drupal 7 hook_block_configure and hook_block_save provide a method to modify a blocks settings and save these values.

But how would I carry out validation on the form before saving the values?


Solution

  • As found here when configuring your form element you should add an '#element_validate' that points to a custom validation function of the element. You can find more information in the Form Api here