Validation

Drupal 8: Add field validation constraint programmatically

In foundation_anchor_menu_block module I needed to add a validation to a field in a block to ensure the entered value matches the regex allowed for an "id" HTML element attribute.