Add Constraint to Paragraph Field I'm attempting to follow this documentation to add a custom constraint to a field in a Paragraph but I'm having trouble actually accessing that field. 

Currently I have my_content_type with paragraph_field. This field accepts a number of different paragraph types. I'd like to be able to add a constraint to a field on a specific paragraph type that could be added to that field. 

I've tried using hook_entity_bundle_field_info_alter, hook_form_alter, and hook_field_widget_form_alter but am having trouble actually accessing the proper field. 

Is there a better way to do this?
@Vecta I hope this help you

function MYMODULE_entity_bundle_field_info_alter(&amp;$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
  //with a node
  if ($entity_type-&gt;id() === 'node') {
    if ($bundle == 'article') {
      if (isset($fields['title'])) {
        // change constraint id
        $fields['title']-&gt;addConstraint('UniqueCode', []);
      }
    }
  }
  //with a paragraph
  if ($entity_type-&gt;id() === 'paragraph') {
    // use the paragraph machine name 
    if ($bundle == 'paragraph_name') {
      if (isset($fields['field_name'])) {
        // change constraint id
        $fields['field_name']-&gt;addConstraint('ConstraintId', []);
      }
    }
  }
}