/**
* Implements hook_entity_bundle_field_info_alter().
*/
#[Hook('entity_bundle_field_info_alter')]
public function entityBundleFieldInfoAlter(&$fields, EntityTypeInterface $entity_type, $bundle) {
if ($entity_type->id() === 'node' && $bundle === 'animal' && isset($fields['field_chip_number'])) {
$fields['field_chip_number']->addPropertyConstraints('value', [
'Length' => [
'min' => 15,
'max' => 15,
'exactMessage' => $this->t('The value must contain exactly %limit characters.'),
],
]);
}
}